[C++-sig] difficulty with has_back_reference example

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Sat Jul 17 20:40:52 CEST 2004


I'm trying to get the has_back_reference example to work.  I started
with the example in the reference manual, which has some errors.  I
removed the const qualifier from the free function Y_self, fixed the
name of the 'x' variable in structs X and Y to 'm_x', and fixed the
semicolon usage in has_back_reference<X>.  However, that still isn't
enough to get it to compile.

I have attached the touched-up example, and the error message (GNU G++
3.4.0 on Linux).  This doesn't compile with G++ 3.3.4, either.

Thanks for your help,
-Jonathan


-------------- next part --------------
A non-text attachment was scrubbed...
Name: back_references.cpp
Type: text/x-c++src
Size: 1228 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040717/66a33dd0/attachment.cpp>
-------------- next part --------------
/usr/include/boost/mpl/aux_/nested_type_wknd.hpp: In instantiation of `boost::mpl::aux::nested_type_wknd<boost::python::has_back_reference<X> >':
/usr/include/boost/mpl/aux_/preprocessed/gcc/or.hpp:21:   instantiated from `boost::mpl::aux::or_impl< false, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >'
/usr/include/boost/mpl/aux_/preprocessed/gcc/or.hpp:47:   instantiated from `boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >'
/usr/include/boost/mpl/if.hpp:75:   instantiated from `boost::mpl::algo_::if_<boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >, boost::python::objects::value_holder_back_reference<X, X>, boost::python::objects::value_holder<X> >'
/usr/include/boost/python/object/select_holder.hpp:110:   instantiated from `boost::python::objects::detail::select_value_holder<X, X>'
/usr/include/boost/python/object/select_holder.hpp:190:   instantiated from `boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/class.hpp:652:   instantiated from `boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:47:   instantiated from here
/usr/include/boost/mpl/aux_/nested_type_wknd.hpp:32: error: no type named `type' in `struct boost::python::has_back_reference<X>'
/usr/include/boost/mpl/aux_/preprocessed/gcc/or.hpp: In instantiation of `boost::mpl::aux::or_impl< false, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >':
/usr/include/boost/mpl/aux_/preprocessed/gcc/or.hpp:47:   instantiated from `boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >'
/usr/include/boost/mpl/if.hpp:75:   instantiated from `boost::mpl::algo_::if_<boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >, boost::python::objects::value_holder_back_reference<X, X>, boost::python::objects::value_holder<X> >'
/usr/include/boost/python/object/select_holder.hpp:110:   instantiated from `boost::python::objects::detail::select_value_holder<X, X>'
/usr/include/boost/python/object/select_holder.hpp:190:   instantiated from `boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/class.hpp:652:   instantiated from `boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:47:   instantiated from here
/usr/include/boost/mpl/aux_/preprocessed/gcc/or.hpp:21: error: `value' is not a member of `boost::mpl::aux::nested_type_wknd<boost::python::has_back_reference<X> >'
/usr/include/boost/mpl/if.hpp: In instantiation of `boost::mpl::algo_::if_<boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >, boost::python::objects::value_holder_back_reference<X, X>, boost::python::objects::value_holder<X> >':
/usr/include/boost/python/object/select_holder.hpp:110:   instantiated from `boost::python::objects::detail::select_value_holder<X, X>'
/usr/include/boost/python/object/select_holder.hpp:190:   instantiated from `boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/class.hpp:652:   instantiated from `boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:47:   instantiated from here
/usr/include/boost/mpl/if.hpp:75: error: `value' is not a member of `boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >'
/usr/include/boost/mpl/if.hpp:78: error: `value' is not a member of `boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >'
/usr/include/boost/python/object/select_holder.hpp: In instantiation of `boost::python::objects::detail::select_value_holder<X, X>':
/usr/include/boost/python/object/select_holder.hpp:190:   instantiated from `boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/class.hpp:652:   instantiated from `boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:47:   instantiated from here
/usr/include/boost/python/object/select_holder.hpp:110: error: no type named `type' in `struct boost::mpl::algo_::if_<boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >, boost::python::objects::value_holder_back_reference<X, X>, boost::python::objects::value_holder<X> >'
/usr/include/boost/python/object/select_holder.hpp:116: error: no type named `type' in `struct boost::mpl::algo_::if_<boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >, boost::python::objects::value_holder_back_reference<X, X>, boost::python::objects::value_holder<X> >'
/usr/include/boost/python/class.hpp: In member function `void boost::python::class_<T, X1, X2, X3>::register_holder() [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]':
/usr/include/boost/python/class.hpp:651:   instantiated from `boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:47:   instantiated from here
/usr/include/boost/python/class.hpp:641: error: no type named `type' in `struct boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/class.hpp:642: error: no type named `type' in `struct boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/class.hpp:642: error: `value' is not a member of `<declaration error>'
/usr/include/boost/python/object/select_holder.hpp: In static member function `static void boost::python::objects::detail::select_value_holder<T, Held>::assert_default_constructible() [with T = X, Held = X]':
/usr/include/boost/python/class.hpp:652:   instantiated from `boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:47:   instantiated from here
/usr/include/boost/python/object/select_holder.hpp:103: error: no matching function for call to `check_default_constructible(X*, X*, boost::mpl::or_<boost::mpl::not_<boost::is_same<X, X> >, boost::python::has_back_reference<X>, boost::mpl::bool_< false>, boost::mpl::bool_< false>, boost::mpl::bool_< false> >)'
/usr/include/boost/python/object/select_holder.hpp:54: note: candidates are: void boost::python::objects::detail::check_default_constructible(T*, U*, boost::mpl::true_) [with T = X, U = X]
/usr/include/boost/python/object/select_holder.hpp:64: note:                 void boost::python::objects::detail::check_default_constructible(T*, T*, boost::mpl::false_) [with T = X]
/usr/include/boost/python/class.hpp: In function `void boost::python::detail::register_class_to_python(boost::mpl::true_, SelectHolder, T*) [with T = X, SelectHolder = boost::python::objects::select_holder<X, boost::python::detail::not_specified>]':
/usr/include/boost/python/class.hpp:631:   instantiated from `void boost::python::class_<T, X1, X2, X3>::register_() const [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
/usr/include/boost/python/class.hpp:640:   instantiated from `void boost::python::class_<T, X1, X2, X3>::register_holder() [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
/usr/include/boost/python/class.hpp:651:   instantiated from `boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:47:   instantiated from here
/usr/include/boost/python/class.hpp:104: error: no type named `type' in `struct boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/class.hpp:105: error: no type named `type' in `struct boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/init.hpp: In function `void boost::python::detail::def_init_aux(ClassT&, const Signature&, NArgs, const CallPoliciesT&, const char*, const boost::python::detail::keyword_range&) [with ClassT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, CallPoliciesT = boost::python::default_call_policies, Signature = boost::mpl::vector1<int>, NArgs = boost::mpl::size<boost::mpl::vector1<int> >]':
/usr/include/boost/python/init.hpp:402:   instantiated from `static void boost::python::detail::define_class_init_helper<0>::apply(ClassT&, const CallPoliciesT&, const Signature&, NArgs, const char*, const boost::python::detail::keyword_range&) [with ClassT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, CallPoliciesT = boost::python::default_call_policies, Signature = boost::mpl::vector1<int>, NArgs = boost::mpl::size<boost::mpl::vector1<int> >]'
/usr/include/boost/python/init.hpp:172:   instantiated from `void boost::python::init_base<DerivedT>::visit(classT&) const [with classT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedT = boost::python::init<int, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_>]'
/usr/include/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::init<int, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_> >, classT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>]'
/usr/include/boost/python/def_visitor.hpp:68:   instantiated from `void boost::python::def_visitor<DerivedVisitor>::visit(classT&) const [with classT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedVisitor = boost::python::init<int, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_>]'
/usr/include/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::init<int, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_>, T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:48:   instantiated from here
/usr/include/boost/python/init.hpp:333: error: `get' is not a member of `boost::python::objects::select_holder<X, boost::python::detail::not_specified>'
/usr/include/boost/python/init.hpp: In function `void boost::python::detail::def_init_aux(ClassT&, const Signature&, NArgs, const CallPoliciesT&, const char*, const boost::python::detail::keyword_range&) [with ClassT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, CallPoliciesT = boost::python::default_call_policies, Signature = boost::mpl::vector0<boost::mpl::void_>, NArgs = boost::mpl::size<boost::mpl::vector0<boost::mpl::void_> >]':
/usr/include/boost/python/init.hpp:402:   instantiated from `static void boost::python::detail::define_class_init_helper<0>::apply(ClassT&, const CallPoliciesT&, const Signature&, NArgs, const char*, const boost::python::detail::keyword_range&) [with ClassT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, CallPoliciesT = boost::python::default_call_policies, Signature = boost::mpl::vector0<boost::mpl::void_>, NArgs = boost::mpl::size<boost::mpl::vector0<boost::mpl::void_> >]'
/usr/include/boost/python/init.hpp:172:   instantiated from `void boost::python::init_base<DerivedT>::visit(classT&) const [with classT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedT = boost::python::init<boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_>]'
/usr/include/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::init<boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_> >, classT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>]'
/usr/include/boost/python/def_visitor.hpp:68:   instantiated from `void boost::python::def_visitor<DerivedVisitor>::visit(classT&) const [with classT = boost::python::class_<X, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedVisitor = boost::python::init<boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_>]'
/usr/include/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::init<boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_>, T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
/usr/include/boost/python/class.hpp:653:   instantiated from `boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with T = X, X1 = boost::python::detail::not_specified, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
back_references.cpp:47:   instantiated from here
/usr/include/boost/python/init.hpp:333: error: `get' is not a member of `boost::python::objects::select_holder<X, boost::python::detail::not_specified>'


More information about the Cplusplus-sig mailing list