[C++-sig] Re: Iterators + shared_ptr + Abstract base classes + Pass by reference = help :)

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Jan 9 18:13:14 CET 2003

--- David Abrahams <dave at boost-consulting.com> wrote:
> Are you sure it wouldn't work to just expose
> std::vector<shared_ptr<Abstract> > using class_ and
> write all the neccessary methods so that it looks like
> a Python List?  The only way your Python code could
> tell the difference would be if you inspected its
> __class__ or did isinstance(x, list) or the like.

If you decide to go down that road have a look at the file


This could serve as a template for a std::vector<> wrapper.

You could also use flex_wrapper.h directly since it is designed
to be used in other packages. It is clearly not a light-weight
approach and you'd have to switch to a reference-counted container
type, but it leads to streamlined Python/C++ integration.


Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

More information about the Cplusplus-sig mailing list