So I have a vector of foo that I exposed with the indexing suite, and I need to deepcopy it. I get a Boost.Python.ArgumentError exception when I try to iterate across the result later.<br><br>&gt;&gt;&gt; from BusyBox import *<br>
&gt;&gt;&gt; foo<br>&lt;class &#39;BusyBox.foo&#39;&gt;<br>&gt;&gt;&gt; vecfoo<br>&lt;class &#39;BusyBox.vecfoo&#39;&gt;<br>&gt;&gt;&gt; vf = vecfoo()<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>
&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>
&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; vf.append(foo())<br>&gt;&gt;&gt; for f in vf:<br>
...&nbsp;&nbsp;&nbsp;&nbsp; f.__repr__()<br>...<br>&#39;&lt;BusyBox.foo object at 0x00A81EF0&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81F70&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81EF0&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81F70&gt;&#39;<br>
&#39;&lt;BusyBox.foo object at 0x00A81EF0&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81F70&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81EF0&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81F70&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81EF0&gt;&#39;<br>
&#39;&lt;BusyBox.foo object at 0x00A81F70&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81EF0&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81F70&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81EF0&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81F70&gt;&#39;<br>
&#39;&lt;BusyBox.foo object at 0x00A81EF0&gt;&#39;<br>&#39;&lt;BusyBox.foo object at 0x00A81F70&gt;&#39;<br>&gt;&gt;&gt; import copy<br>&gt;&gt;&gt; vf2 = copy.deepcopy(vf)<br>&gt;&gt;&gt; for f in vf2:<br>...&nbsp;&nbsp;&nbsp;&nbsp; f.__repr__()<br>
...<br>Traceback (most recent call last):<br>&nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>Boost.Python.ArgumentError: Python argument types in<br>&nbsp;&nbsp;&nbsp; vecfoo.__iter__(vecfoo)<br>did not match C++ signature:<br>
&nbsp;&nbsp;&nbsp; __iter__(struct boost::python::back_reference&lt;class std::vector&lt;struct foo,class std::allocator&lt;struct foo&gt; &gt; &amp;&gt;)<br>&gt;&gt;&gt;<br><br>here is my c++ code:<br>struct foo<br>{<br>&nbsp;&nbsp;&nbsp; foo(){} ;<br>
&nbsp;&nbsp;&nbsp; foo(int init_x, int init_y){x=init_x;y=init_y;};<br>&nbsp;&nbsp;&nbsp; int x;<br>&nbsp;&nbsp;&nbsp; int y;<br><br>&nbsp;&nbsp;&nbsp; bool operator==(const foo &amp;rhs) const;<br>};<br><br>bool foo::operator==(const foo &amp;rhs) const {return (this == &amp;rhs);}<br>
struct foo_wrapper : foo , wrapper&lt;foo&gt;<br>{<br>&nbsp;&nbsp;&nbsp; foo_wrapper();<br>&nbsp;&nbsp;&nbsp; foo_wrapper(const foo&amp; f);<br>&nbsp;&nbsp;&nbsp; foo_wrapper(int init_x, int init_y);<br>&nbsp;&nbsp;&nbsp; static bool eq(const foo&amp; lhs, const foo &amp;rhs);<br>
};<br>foo_wraper::foo_wrapper(const foo&amp; exch): foo(exch), wrapper&lt;foo&gt;(){}<br>foo_wrapper::foo_wrapper(): foo(), wrapper&lt;foo&gt;(){}<br>foo_wrapper::foo_wrapper(int init_x, int init_y) : foo(init_x,init_y), wrapper&lt;foo&gt;(){}<br>
bool foo_wrapper::eq(const foo&amp; lhs, const foo &amp;rhs) {return (lhs == rhs);}<br><br>Later:<br><br>&nbsp;&nbsp;&nbsp; class_&lt;foo_wrapper&gt;(&quot;foo&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .def(init&lt;&gt;())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .def(init&lt;int, int&gt;())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .def_readwrite(&quot;x&quot;, &amp;foo::x )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .def_readonly (&quot;y&quot;, &amp;foo::y )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .def(&quot;__eq__&quot;, &amp;foo_wrapper::eq)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br><br>&nbsp;&nbsp;&nbsp; class_&lt;std::vector&lt;foo&gt; &gt; (&quot;vecfoo&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .def(vector_indexing_suite&lt; std::vector&lt;foo&gt;, true &gt;() );<br><br><br><br>