[C++-sig] [Boost.Python] shared_ptr<const T>

Charles Flèche charlesf at the-mill.com
Fri Nov 17 17:02:52 CET 2006


Hello everybody !

I've googled a lot and I wasn't able to find an answer for this, I
think, easy beginner question.

Let's say I have a that class :

///////////////////
// Classe.h
///////////////////

class Classe
{
    public:
        Classe();
};


///////////////////
// Classe.cpp
///////////////////

Classe::Classe()
{
}

////////////////////


I'm wrapping it inside my Boost.Python section :

class_< Classe >( "Classe" )
;

register_ptr_to_python< boost::shared_ptr<Classe> >();



I'd like to register a shared_ptr<const Classe>, but I am not able to do
it. When I do a register_ptr_to_python< boost::shared_ptr<const Classe>
>(), I have that error in my logs :

[...]
.../pointer_holder.hpp:138: error: invalid conversion from `const void*'
to `void*'
[...]


How can I register a shared_ptr<const Classe> ?

Thank you a lot !!

-- 
Charles Fleche
The Mill, London




More information about the Cplusplus-sig mailing list