title: Exposing std::vector<struct> with boost.python
body: <p>I have an existing c++ code library that uses a struct with std::vector, which should be exposed to python.</p>
  
  <p>in the header: </p>
  
  <pre><code>struct sFOO
  {
      unsigned int start = 3 ;
      double foo = 20.0 ;
  };
  </code></pre>
  
  <p>in the cpp: </p>
  
  <pre><code>namespace myName
  {
  myfoo::myfoo(){   
      sFOO singlefoo;
      std::vector&lt;sFOO&gt; foos;
  }
  sFOO singlefoo;            
  
  std::vector&lt;sFOO&gt;* myfoo::get_vector(){
      return &amp;foos;
  }
  }
  </code></pre>
  
  <p>and for boost::python snippet:</p>
  
  <pre><code>using namespace boost::python;
  
  class dummy3{};
  
  BOOST_PYTHON_MODULE(vStr)
  {
  scope myName = class_&lt;dummy3&gt;("myName");
  
  class_&lt;myName::sFOO&gt;("sFOO")
      .add_property("start",&amp;myName::sFOO::start)
      .add_property("foo",&amp;myName::sFOO::foo)
      ;
  
  class_&lt;myName::myfoo&gt;("myfoo", no_init)
      .def(init&lt;&gt;())
      .def("checkfoo",&amp;myName::myfoo::checkfoo)
      .add_property("foos",&amp;myName::myfoo::foos) 
      .add_property("singlefoo",&amp;myName::myfoo::singlefoo)
  }
  </code></pre>
  
  <p>(FYI, fictitious class dummy3 is used to simulate namespace, and using scope is therefore not an option.)</p>
  
  <p>A compilation and importing processes are OK, and I can access singlefoo, but whenever I try to access vector foos, I encounter the error message below.</p>
  
  <pre><code>Python class registered for C++ class std::vector&lt;myName::sFOO, 
  std::allocator&lt;myName::sFOO&gt; &gt;
  </code></pre>
  
  <p>To circumvent this issue, 
  I've firstly tried vector_indexing_suite, but it didn't help exposing pre-defined vector of struct.</p>
  
  <p>I also assumed that there should be a solution related to exposing pointer to python, so I have tried to get a pointer by following:</p>
  
  <pre><code>    .def("get_vector",&amp;myName::myfoo::get_vector) 
  </code></pre>
  
  <p>which produces compile Error.</p>
  
  <p>Since I am quite a novice to both C++ and Boost, any comments including solution, tips for search, and a suggestion to suitable reference would be greatly appreciated. </p>
  
  <p>Thanks in advance!</p>