|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-07-08 07:38:55
The formula is simple: just use this technique:
BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE // this is a gcc 2.95.2 bug
workaround
template <class T>
PyObject* to_python(my_smart_ptr<T> p)
{
return
boost::python::python_extension_class_converters<T>::ptr_to_python(p);
}
BOOST_PYTHON_END_CONVERSION_NAMESPACE
-Dave
----- Original Message -----
From: "Trevor Perrin" <tperrin_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, July 07, 2001 11:22 PM
Subject: [boost] Python & smart pointers
>
> An uninformed question by a Boost.Python newbie:
>
> I've previously created a modified boost::smart_ptr for myself, and moved
it
> into a 'boostold' namespace. Now I'd like to use at least
> boostold::shared_ptr with Boost.Python. As a first stab I duplicated the
> bottom 4 converter member functions in
> extension_class.hpp/python_extension_class_converters, which refer to
> 'boost::shared_ptr', and changed 'boost::shared_ptr' to
> 'boostold::shared_ptr'.
>
> Which seems to work (I'm using vc6sp4; also I don't care about
> cross-extension-module dependencies right now), but I'm wondering if
there's
> a cleaner way to insert these converters into boost.python than modifying
> its code. I'm also quite confused by the shared_ptr converter code within
> conversions.hpp; what is "wrapped_pointer", for example? Is the
> "MUST_SUPPORT_MSVC" code in the comments an idiom I should be using?
>
> Trevor
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk