$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Trevor Perrin (tperrin_at_[hidden])
Date: 2001-07-08 14:58:17
Thanks.  What about from_python()?  By analogy with
python_extension_class_converters I tried:
template <class T>
boostold::shared_ptr<T>& from_python(PyObject* p, boostold::shared_ptr<T>&)
{ 
  return
boost::python::python_extension_class_converters<T>::smart_ptr_reference(p,
boost::python::type<boostold::shared_ptr<T> >());
}
-----Original Message-----
From: David Abrahams [mailto:david.abrahams_at_[hidden]] 
Sent: Sunday, July 08, 2001 5:39 AM
To: boost_at_[hidden]
Subject: Re: [boost] Python & smart pointers
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/
>
>
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/