[C++-sig] mapping object pointers with boost

Alex Mohr amohr at pixar.com
Wed Oct 11 02:16:40 CEST 2006


> One more question... (probably more of just a basic C++ question -
> it's a little rusty)
> 
> The code has a nested class Dictionary inside NdbDictionary. The
> Dictionary class has a method, getTable. So I tried this:
> 
> class_<NdbDictionary::Dictionary,boost::noncopyable>("Dictionary",no_init)
>     .def("getTable", &NdbDictionary::Dictionary::getTable,
> 	 return_value_policy<reference_existing_object>() )
>     ;
> 
> But it doesn't see getTable as a method - it sees NdbDictionary as a
> method that it can't find. How do I tell it how to find the original
> method?

On the surface this looks correct to me.  I've wrapped stuff like this:

class Foo {
     class Bar {
         void method() {}
     };
};

Similarly before, using &Foo::Bar::method to get a pointer to the method.

Are you using a peculiar compiler or are any of these private/protected?

Or -- if your wrapping code is in a template, you might have to say 
something like:

typedef typename NdbDictionary::Dictionary Dictionary;

and then:

&Dictionary::getTable

But as Stefan says, more details would help.

Alex



More information about the Cplusplus-sig mailing list