title: PyBind - Overloaded functions
body: <p>Firstly, my thanks to all of you for trying to resolve this doubt of mine. I am working on converting a minimal C++ project to be used in Python. The real reason behind this effort is for speed.</p>
  <p>I came across PyBind and was quite surprised at its capabilities and also the amount of documentation they have provided. Right now there is something stopping the work because I have no idea on how to do it. Consider the below code in the file &quot;MySource.hpp&quot; and can you kindly tell me how a binding can be done?</p>
  <pre class="lang-cpp prettyprint-override"><code>    struct Point3D  
      {
      public:
          double x, y, z;
          CPoint3D();
          CPoint3D(double x, double y, double z); 
          inline double Len() const;
          inline void Normalize();
      };
  
      Point3D VectorCross(const Point3D&amp; pt1, const Point3D&amp; pt2, const Point3D&amp; pt3);
      void VectorCross(const float* u, const float* v, float * n);
  </code></pre>
  <p>I was able to define a binding for Point3D as a class and certain of its member functions. But I don't have a clue about how to do the binding for the overloaded method &quot;<strong>VectorCross</strong>&quot;. It has two methods with one accepting instances of Point3D, and another one accepting pointers to float arrays.</p>
  <p>The binding I wrote so far is shown below</p>
  <pre class="lang-cpp prettyprint-override"><code>PYBIND11_MODULE(mymodule, m)
  {
      py::class_&lt;Point3D&gt; point3d(m, &quot;Point3D&quot;);
      point3d.def_readwrite(&quot;x&quot;, &amp;CPoint3D::x);
      point3d.def_readwrite(&quot;y&quot;, &amp;CPoint3D::y);
      point3d.def_readwrite(&quot;z&quot;, &amp;CPoint3D::z);
      point3d.def(py::init&lt;&gt;());
      point3d.def(py::init&lt;double , double , double &gt;());
      point3d.def(&quot;Len&quot;, &amp;CPoint3D::Len);
      point3d.def(&quot;Normalize&quot;, &amp;CPoint3D::Normalize);
  }
  </code></pre>
  <p>Can someone please guide me on how to do this?</p>