[C++-sig] Re: operator ->, cast operator

Leonard "paniq" Ritter paniq at paniq.org
Sun Mar 13 00:10:39 CET 2005


>Yeah, just export View using Ptr<View> as the HeldType.
>
>
as if it were that easy! ;)

i followed the manual for that and exposed Ptr<T> as a pointee using

namespace boost
{
    namespace python
    {
        template <typename T>
        struct pointee< Mu::Ptr<T> >
        {
            typedef T type;
        };
    }
}

in a macro that exposes the class to python, class_ is instantiated like
this

class_<ClassType, bases<BaseClassType>, Ptr<ClassType>,
boost::noncopyable > exportedClass(interfaceName, no_init)

where ClassType is an interface class.

the compiler gives me:

p:\MuFramework\Shared\Code\boost\boost\python\object\make_ptr_instance.hpp(30) 

: error C2784: 'T *boost::python::get_pointer(const
boost::python::handle<T> &)' : could not deduce template argument for
'const boost::python::handle<T> &' from 'const
boost::python::objects::class_metadata<T,X1,X2,X3>::held_type'
        with
        [
            T=ClassType,
            X1=boost::python::bases<BaseClassType>,
            X2=Mu::Ptr<ClassType>,
            X3=boost::noncopyable
        ]
        p:\MuFramework\Shared\Code\boost\boost\python\handle.hpp(143) :
see declaration of 'boost::python::get_pointer'

p:\MuFramework\Shared\Code\boost\boost\python\object\make_instance.hpp(26)
: see reference to function template instantiation 'PyTypeObject
*boost::python::objects::make_ptr_instance<T,Holder>::get_class_object<Arg>(const 

Ptr &)' being compiled
        with
        [
            T=ClassType,

Holder=boost::python::objects::pointer_holder<boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,ClassType>,

Arg=boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,

Ptr=boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type
        ]

p:\MuFramework\Shared\Code\boost\boost\python\object\class_wrapper.hpp(36)
: see reference to function template instantiation 'PyObject
*boost::python::objects::make_instance_impl<T,Holder,Derived>::execute<Src>(Arg 

&)' being compiled
        with
        [
            T=ClassType,

Holder=boost::python::objects::pointer_holder<boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,ClassType>,

Derived=boost::python::objects::make_ptr_instance<ClassType,boost::python::objects::pointer_holder<boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,ClassType>>,

Src=boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,

Arg=boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type
        ]

p:\MuFramework\Shared\Code\boost\boost\python\object\class_wrapper.hpp(35)
: while compiling class-template member function 'PyObject
*boost::python::objects::class_value_wrapper<Src,MakeInstance>::convert(Src)'
        with
        [

Src=boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,

MakeInstance=boost::python::objects::make_ptr_instance<ClassType,boost::python::objects::pointer_holder<boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,ClassType>>
        ]

p:\MuFramework\Shared\Code\boost\boost\python\object\class_metadata.hpp(237) 

: see reference to class template instantiation
'boost::python::objects::class_value_wrapper<Src,MakeInstance>' being
compiled
        with
        [

Src=boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,

MakeInstance=boost::python::objects::make_ptr_instance<ClassType,boost::python::objects::pointer_holder<boost::python::objects::class_metadata<ClassType,boost::python::bases<BaseClassType>,Mu::Ptr<ClassType>,boost::noncopyable>::held_type,ClassType>>
        ]

p:\MuFramework\Shared\Code\boost\boost\python\object\class_metadata.hpp(221) 

: see reference to function template instantiation 'void
boost::python::objects::class_metadata<T,X1,X2,X3>::maybe_register_pointer_to_python<T2>(T2 

*,boost::mpl::false_ *,boost::mpl::false_ *)' being compiled
        with
        [
            T=ClassType,
            X1=boost::python::bases<BaseClassType>,
            X2=Mu::Ptr<ClassType>,
            X3=boost::noncopyable,
            T2=ClassType
        ]

p:\MuFramework\Shared\Code\boost\boost\python\object\class_metadata.hpp(208) 

: see reference to function template instantiation 'void
boost::python::objects::class_metadata<T,X1,X2,X3>::register_aux2<T,boost::mpl::bool_<C_>>(T2 

*,Callback)' being compiled
        with
        [
            T=ClassType,
            X1=boost::python::bases<BaseClassType>,
            X2=Mu::Ptr<ClassType>,
            X3=boost::noncopyable,
            C_=false,
            T2=ClassType,
            Callback=boost::mpl::bool_<false>
        ]

p:\MuFramework\Shared\Code\boost\boost\python\object\class_metadata.hpp(206) 

: while compiling class-template member function 'void
boost::python::objects::class_metadata<T,X1,X2,X3>::register_aux(void *)'
        with
        [
            T=ClassType,
            X1=boost::python::bases<BaseClassType>,
            X2=Mu::Ptr<ClassType>,
            X3=boost::noncopyable
        ]
        p:\MuFramework\Shared\Code\boost\boost\python\class.hpp(174) :
see reference to class template instantiation
'boost::python::objects::class_metadata<T,X1,X2,X3>' being compiled
        with
        [
            T=ClassType,
            X1=boost::python::bases<BaseClassType>,
            X2=Mu::Ptr<ClassType>,
            X3=boost::noncopyable
        ]
        p:\MuFramework\Shared\Code\boost\boost\python\class.hpp(592) :
see reference to class template instantiation
'boost::python::class_<W,X1,X2,X3>::id_vector' being compiled
        with
        [
            W=ClassType,
            X1=boost::python::bases<BaseClassType>,
            X2=Mu::Ptr<ClassType>,
            X3=boost::noncopyable
        ]
        c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\deque(19) : while compiling class-template member
function 'boost::python::class_<W,X1,X2,X3>::class_(const char
*,boost::python::no_init_t)'
        with
        [
            W=ClassType,
            X1=boost::python::bases<BaseClassType>,
            X2=Mu::Ptr<ClassType>,
            X3=boost::noncopyable
        ]
        p:\MuFramework\Libraries\MuPython\MuPython.Sandoz.h(37) : see
reference to class template instantiation
'boost::python::class_<W,X1,X2,X3>' being compiled
        with
        [
            W=ClassType,
            X1=boost::python::bases<BaseClassType>,
            X2=Mu::Ptr<ClassType>,
            X3=boost::noncopyable
        ]


any idea?





More information about the Cplusplus-sig mailing list