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

Monty Taylor monty at inaugust.com
Wed Oct 11 03:09:21 CEST 2006


No luck. I tried this:

BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(dict_overloads, getTable, 1, 2)

and

  class_<NdbDictionary::Dictionary,boost::noncopyable>("Dictionary",no_init)
    .def("getTable", &NdbDictionary::Dictionary::getTable,
	 dict_overloads("name")[reference_existing_object<>()] )
    ;

based on the example code:

http://www.boost.org/libs/python/doc/v2/overloads.html#BOOST_PYTHON_FUNCTION_OVERLOADS-spec

And still get:
_ndb.cpp: In function 'void init_module__ndb()':
_ndb.cpp:53: error: 'boost::python::reference_existing_object' is not a template
_ndb.cpp:53: error: no matching function for call to
'boost::python::class_<NdbDictionary::Dictionary,
boost::noncopyable_::noncopyable,
boost::python::detail::not_specified,
boost::python::detail::not_specified>::def(const char [9], <unresolved
overloaded function type>,
boost::python::detail::overloads_proxy<boost::python::reference_existing_object,
dict_overloads>)'




On 10/10/06, Monty Taylor <monty at inaugust.com> wrote:
> The compiler (g++ 4.1) seems to see both methods, at least based on
> seeing the output of what it considers candidates. I'll try treating
> the method as overloaded and see where I can get.
>
> error: no matches converting function 'getTable' to type 'struct
> Table* (*)(const char*)'
> /usr/include/mysql/ndb/ndbapi/NdbDictionary.hpp:1174: error:
> candidates are: const NdbDictionary::Table*
> NdbDictionary::Dictionary::getTable(const char*) const
> /usr/include/mysql/ndb/ndbapi/NdbDictionary.hpp:1331: error:
>       const NdbDictionary::Table*
> NdbDictionary::Dictionary::getTable(const char*, void**) const
>
>
> On 10/10/06, Monty Taylor <monty at inaugust.com> wrote:
> > I'll try real quick.
> >
> > On 10/10/06, Alex Mohr <amohr at pixar.com> wrote:
> > > > well... it didn't look that way, but  NdbDictionary does have one as
> > > > well, so the nested scoping may be doing it?
> > > >
> > > > So the whole picture is more like:
> > > > class NdbDictionary {
> > > >  class Dictionary {
> > > >    const Table * getTable(const char * name) const;
> > > >  }
> > > >  const Table * getTable(const char * name, void **data) const;
> > > > }
> > >
> > > Hmm.  Well, your compiler is claiming that the argument passed to def()
> > > is an "unresolved overloaded function type".  Is your compiler broken?
> > >
> > > Can you write code that takes the address of
> > > NdbDictionary::Dictionary::getTable outside the context of boost.python?
> > >
> > > Alex
> > > _______________________________________________
> > > C++-sig mailing list
> > > C++-sig at python.org
> > > http://mail.python.org/mailman/listinfo/c++-sig
> > >
> >
>



More information about the Cplusplus-sig mailing list