List Info

Thread: Re: std::tr1::shared_ptr and C++ Singletons




Re: std::tr1::shared_ptr and C++ Singletons
country flaguser name
Poland
2007-03-15 16:39:01
> 1) class_<Foo, std::tr1::shared_ptr<Foo> >
doesn't work=compile errors
> while boost::shared_ptr does. In the code I am writing
bindings for
> std::tr1::shared_ptr is used.
The fix is rather simple, one needs to declare the following
get_pointer 
template before including boost/python.hpp. Maybe it's worth
adding to the 
boost?

namespace boost {
template<class T> inline T *
get_pointer(std::tr1::shared_ptr<T> const & p){
        return p.get();
}
}


-- 
Best Regards,
Piotr Jaroszynski
_______________________________________________
C++-sig mailing list
C++-sigpython.org
http:
//mail.python.org/mailman/listinfo/c++-sig

Re: std::tr1::shared_ptr and C++ Singletons
country flaguser name
United States
2007-03-15 17:26:52
Piotr Jaroszynski wrote:
>> 1) class_<Foo, std::tr1::shared_ptr<Foo>
> doesn't work=compile errors
>> while boost::shared_ptr does. In the code I am
writing bindings for
>> std::tr1::shared_ptr is used.
> The fix is rather simple, one needs to declare the
following get_pointer 
> template before including boost/python.hpp. Maybe it's
worth adding to the 
> boost?
> 
> namespace boost {
> template<class T> inline T *
get_pointer(std::tr1::shared_ptr<T> const & p){
>         return p.get();
> }
> }

As I said on IRC: I don't think this is 'correct', as boost
and tr1 are two
disjunct sets of APIs. I don't know the details of how the
converters work,
but I'd guess just declaring the above get_pointer()
function so it makes
its way into the overload set seen when the compiler
instantiates the conerter
harness should be enough.

If it isn't, a (simple, minimal) test case may be a good
idea. 

Regards,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...
_______________________________________________
C++-sig mailing list
C++-sigpython.org
http:
//mail.python.org/mailman/listinfo/c++-sig

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )