[C++-sig] Call policies choice

Roman Yakovenko roman.yakovenko at gmail.com
Wed Aug 8 19:50:33 CEST 2007


On 8/8/07, Coockie_jr <achille.talon at gmail.com> wrote:
>
> Thanks that helped (and the sleeping part too I guess) !
> I've got another issue
>
> I'm wrapping a "list" class
>
>
> class NeoList: public NeoCollection{
> public:
>         NeoList();
>         ~NeoList();
>         virtual void set(unsigned short index,NeoMsgType* pType);
>         virtual NeoMsgType* get(unsigned short index) const;
>         ...
> };
>
>
> class NeoText:public NeoMsgType{
> public:
>         explicit NeoText(const string& str);
>         virtual string toString()const{return m_string;}
>         ...
> };
>
>
> class NeoMsgType
> {
> public:
>         explicit NeoMsgType(uint8_t idType = 0xff);
>         virtual ~NeoMsgType(){}
>         virtual string toString() const = 0;
>
> };
>
> But there seems to be a problem with the get function  because when I test
> the generated .pyd with python and this example
>
> import neolib
> n = neolib;
> message1 = n.NeoText('first message');
> message2 = n.NeoText('2ndmessage');
> l = n.NeoList();
> l.set(1,message1);
> l.set(2,message2);
> recup1 = l.get(1);
> recup2 = l.get(2);
> print "type of recup1 : %s " % recup1;
>
>
> I get that recup1 is a none type.
> I suppose this is a call policy issue as well.
>
> I tried with internal_reference and others but I get the same result.
> With copy_const_reference the lib doesn't compile.
>
> Any clue ?

*Small* and *complete* example is needed :-)

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list