[C++-sig] Py++ module for code with protected operator=
Roman Yakovenko
roman.yakovenko at gmail.com
Sun Mar 21 06:07:19 CET 2010
On Sat, Mar 20, 2010 at 11:10 PM, Maciej Sitarz <macieksitarz at wp.pl> wrote:
> Just one more comment...
>
> The constructor takes reference to vector<JobPropertyWrapper>, so I suspect
> that maybe it will be filled there by some other code I don't have? So I
> don't need to fill the vector, just to create it (I will ask the developers)
Right, you'd better talk with them. Boost.Python allows to export
libraries without touching them, but sometimes a small library change
could make you task easier.
The following code works:
#include <vector>
struct item_t{
explicit item_t( int v)
: value( v )
{}
int value;
protected:
item_t& operator=( const item_t& other );
};
int main( int argc, const char** argv ){
std::vector< item_t > values( 10, item_t( 12 ));
for( size_t i = 0; i < values.size(); ++i ){
values[ i ].value = i;
}
}
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list