title: pybind with array as class attribute
body: <p>I want to wrap the following C++ code into python using pybind</p>
  
  <pre><code>class Galaxy {
  
  public:
      double x[3];
      double v[3];
  
  };
  
  class GalaxyCatalogue {
  
  public:
      long n_tracers;
      Galaxy *object;
  
      GalaxyCatalogue(long n_tracers);
  
      ~GalaxyCatalogue();
  
  };
  
  GalaxyCatalogue::GalaxyCatalogue(long n_tracers) : n_tracers(n_tracers) {
  
      std::cout &lt;&lt; "from galaxies " &lt;&lt; n_tracers &lt;&lt; std::endl;
      object = new Galaxy[n_tracers];
      std::cout &lt;&lt; "has been allocated " &lt;&lt; std::endl;
  
  }
  
  GalaxyCatalogue::~GalaxyCatalogue() {
  
      delete[] object;
  
  }
  </code></pre>
  
  <p>The first problem I have is that Galaxy doesn't have a constructor, so I'm not sure what to do with that. Even if  I declare an empty constructor I don't know how to treat the array in a way that I don't get an error when compiling. This is what I've tried:</p>
  
  <pre><code>#include &lt;pybind11/pybind11.h&gt;
  #include &lt;iostream&gt;
  namespace py = pybind11;
  
  class Galaxy {
     public:
    Galaxy();
   double x[3];
  };
  
  PYBIND11_MODULE(example, m){
    py::class_&lt;Galaxy&gt;(m, "Galaxy")
   .def(py::init&lt;&gt;())
   .def_readwrite("x", &amp;Galaxy::x);
   }
  </code></pre>
  
  <p>This is how I compile it:</p>
  
  <pre><code>c++ -O3 -Wall -shared -std=c++11 -fPIC `python3 -m pybind11 --includes` gal.cpp -o example`python3-config --extension-suffix`
  </code></pre>
  
  <p>and this is the error I get:</p>
  
  <pre><code>In file included from gal.cpp:1:
  /home/florpi/.conda/envs/virtualito/include/python3.5m/pybind11/pybind11.h: In instantiation of ‘pybind11::class_&lt;type_, options&gt;&amp; pybind11::class_&lt;type_, options&gt;::def_readwrite(const char*, D C::*, const Extra&amp; ...) [with C = Galaxy; D = double [3]; Extra = {}; type_ = Galaxy; options = {}]’:
  gal.cpp:19:33:   required from here
  /home/florpi/.conda/envs/virtualito/include/python3.5m/pybind11/pybind11.h:1163:65: error: invalid array assignment
                        fset([pm](type &amp;c, const D &amp;value) { c.*pm = value; }, is_method(*this));
                                                             ~~~~~~^~~~~~~
  In file included from gal.cpp:1:
  
  /home/florpi/.conda/envs/virtualito/include/python3.5m/pybind11/pybind11.h:64:5: error: ‘pybind11::cpp_function::cpp_function(Func&amp;&amp;, const Extra&amp; ...) [with Func = pybind11::class_&lt;type_, options&gt;::def_readwrite(const char*, D C::*, const Extra&amp; ...) [with C = Galaxy; D = double [3]; Extra = {}; type_ = Galaxy; options = {}]::&lt;lambda(pybind11::class_&lt;Galaxy&gt;::type&amp;, const double (&amp;)[3])&gt;; Extra = {pybind11::is_method}; &lt;template-parameter-1-3&gt; = void]’, declared using local type ‘pybind11::class_&lt;type_, options&gt;::def_readwrite(const char*, D C::*, const Extra&amp; ...) [with C = Galaxy; D = double [3]; Extra = {}; type_ = Galaxy; options = {}]::&lt;lambda(pybind11::class_&lt;Galaxy&gt;::type&amp;, const double (&amp;)[3])&gt;’, is used but never defined [-fpermissive]
       cpp_function(Func &amp;&amp;f, const Extra&amp;... extra) {
       ^~~~~~~~~~~~
  </code></pre>
  
  <p>Thank you in advance.</p>