using map_indexing_suite: make_tuple ambiguous?
I am trying to wrap a std::map<> using the map_indexing_suite<>, however I am getting 'call of overloaded make_tuple() is ambiguous'. The simplest case to reproduce this error is to modify boost/libs/python/test/map_indexing_suite.cpp, and add the following small bit of code: // Compile check only... class_<std::map<std::string, boost::shared_ptr<X> > >("TestMap") .def(map_indexing_suite<std::map<std::string, boost::shared_ptr<X> > >()) ; I don't see why this is any different than any of the other tests in that file. But for some reason (using Boost 1.31 on Debian stable, gcc 3.3), I get the following output: [db@ivo ~/src/boost/libs/python/test] bjam ...patience... ...found 5307 targets... ...updating 2 targets... gcc-C++-action ../../../bin/boost/libs/python/test/map_indexing_suite_ext.so/gcc/debug/shared-linkable-true/map_indexing_suite.o /home/db/src/boost_1_31_0/boost/python/suite/indexing/map_indexing_suite.hpp: In static member function `static boost::python::api::object boost::python::map_indexing_suite<Container, NoProxy, DerivedPolicies>::print_elem(typename Container::value_type&) [with Container = std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > >, bool NoProxy = false, DerivedPolicies = boost::python::detail::final_map_derived_policies<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > >, false>]': /home/db/src/boost_1_31_0/boost/python/suite/indexing/map_indexing_suite.hpp:85: instantiated from `static void boost::python::map_indexing_suite<Container, NoProxy, DerivedPolicies>::extension_def(Class&) [with Class = boost::python::class_<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, Container = std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > >
, bool NoProxy = false, DerivedPolicies = boost::python::detail::final_map_derived_policies<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , false>]' /home/db/src/boost_1_31_0/boost/python/suite/indexing/indexing_suite.hpp:188: instantiated from `void boost::python::indexing_suite<Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key>::visit(Class&) const [with Class = boost::python::class_<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, Container = std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , DerivedPolicies = boost::python::detail::final_map_derived_policies<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , false>, bool NoProxy = false, bool NoSlice = true, Data = boost::shared_ptr<X>, Index = std::string, Key = std::string]' /home/db/src/boost_1_31_0/boost/python/def_visitor.hpp:32: instantiated from `static void boost::python::def_visitor_access::visit(const V&, classT&) [with V = boost::python::def_visitor<boost::python::indexing_suite<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , boost::python::detail::final_map_derived_policies<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , false>, false, true, boost::shared_ptr<X>, std::string, std::string> >, classT = boost::python::class_<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>]' /home/db/src/boost_1_31_0/boost/python/def_visitor.hpp:68: instantiated from `void boost::python::def_visitor<DerivedVisitor>::visit(classT&) const [with classT = boost::python::class_<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedVisitor = boost::python::indexing_suite<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , boost::python::detail::final_map_derived_policies<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , false>, false, true, boost::shared_ptr<X>, std::string, std::string>]' /home/db/src/boost_1_31_0/boost/python/class.hpp:294: instantiated from `boost::python::class_<T, X1, X2, X3>& boost::python::class_<T, X1, X2, X3>::def(const boost::python::def_visitor<Derived>&) [with Derived = boost::python::indexing_suite<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , boost::python::detail::final_map_derived_policies<std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > , false>, false, true, boost::shared_ptr<X>, std::string, std::string>, T = std::map<std::string, boost::shared_ptr<X>, std::less<std::string>, std::allocator<std::pair<const std::string, boost::shared_ptr<X> > > >, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]' ../../../libs/python/test/map_indexing_suite.cpp:50: instantiated from here /home/db/src/boost_1_31_0/boost/python/suite/indexing/map_indexing_suite.hpp:95: error: call of overloaded `make_tuple(const std::string&, const boost::shared_ptr<X>&)' is ambiguous /home/db/src/boost_1_31_0/boost/python/detail/make_tuple.hpp:24: error: candidates are: boost::python::tuple boost::python::make_tuple(const A0&, const A1&) [with A0 = std::string, A1 = boost::shared_ptr<X>] /home/db/src/boost_1_31_0/boost/tuple/detail/tuple_basic.hpp:717: error: typename boost::tuples::detail::make_tuple_mapper<T0, T1, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>::type boost::tuples::make_tuple(const T0&, const T1&) [with T0 = std::string, T1 = boost::shared_ptr<X>]
Any ideas? db
Dave Berton <db@nec-labs.com> writes:
I am trying to wrap a std::map<> using the map_indexing_suite<>, however I am getting 'call of overloaded make_tuple() is ambiguous'. The
The compiler is right. There's a bug in map_indexing_suite.hpp (or the C++ language definition; darned ADL again!) You should change line 95 from: return "(%s, %s)" % make_tuple(e.first, e.second); to return "(%s, %s)" % python::make_tuple(e.first, e.second); Joel, will you add Dave Berton's change to the test suite, then make this change in CVS and verify that it fixes things? Thanks! -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
David Abrahams wrote:
The following message is a courtesy copy of an article that has been posted to gmane.comp.python.c++ as well.
Dave Berton <db@nec-labs.com> writes:
I am trying to wrap a std::map<> using the map_indexing_suite<>, however I am getting 'call of overloaded make_tuple() is ambiguous'. The
The compiler is right. There's a bug in map_indexing_suite.hpp (or the C++ language definition; darned ADL again!)
You should change line 95 from:
return "(%s, %s)" % make_tuple(e.first, e.second);
to
return "(%s, %s)" % python::make_tuple(e.first, e.second);
Joel, will you add Dave Berton's change to the test suite, then make this change in CVS and verify that it fixes things?
Done. I added a test and verified that everything works as expected. I'm having some CVS problems, however. I'll commit as soon as I find out why I'm getting these CVS errors. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Joel de Guzman <joel@boost-consulting.com> writes:
David Abrahams wrote:
The following message is a courtesy copy of an article that has been posted to gmane.comp.python.c++ as well. Dave Berton <db@nec-labs.com> writes:
I am trying to wrap a std::map<> using the map_indexing_suite<>, however I am getting 'call of overloaded make_tuple() is ambiguous'. The The compiler is right. There's a bug in map_indexing_suite.hpp (or the C++ language definition; darned ADL again!) You should change line 95 from: return "(%s, %s)" % make_tuple(e.first, e.second); to return "(%s, %s)" % python::make_tuple(e.first, e.second); Joel, will you add Dave Berton's change to the test suite, then make this change in CVS and verify that it fixes things?
Done. I added a test and verified that everything works as expected. I'm having some CVS problems, however. I'll commit as soon as I find out why I'm getting these CVS errors.
If your CVS/Root files say cvs.boost.sourceforge.net you need to change them to say cvs.sourceforge.net. I posted a procedure that works in cygwin bash to the boost-devel list a few days ago. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
David Abrahams wrote:
Joel de Guzman <joel@boost-consulting.com> writes:
David Abrahams wrote:
The following message is a courtesy copy of an article that has been posted to gmane.comp.python.c++ as well. Dave Berton <db@nec-labs.com> writes:
I am trying to wrap a std::map<> using the map_indexing_suite<>, however I am getting 'call of overloaded make_tuple() is ambiguous'. The
The compiler is right. There's a bug in map_indexing_suite.hpp (or the C++ language definition; darned ADL again!) You should change line 95 from: return "(%s, %s)" % make_tuple(e.first, e.second); to return "(%s, %s)" % python::make_tuple(e.first, e.second); Joel, will you add Dave Berton's change to the test suite, then make this change in CVS and verify that it fixes things?
Done. I added a test and verified that everything works as expected. I'm having some CVS problems, however. I'll commit as soon as I find out why I'm getting these CVS errors.
If your CVS/Root files say cvs.boost.sourceforge.net you need to change them to say cvs.sourceforge.net. I posted a procedure that works in cygwin bash to the boost-devel list a few days ago.
Yeah, I realized that. It's been committed. -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
participants (3)
-
Dave Berton -
David Abrahams -
Joel de Guzman