|
Boost Users : |
Subject: [Boost-users] boost::bind issues revisited
From: Littlefield, Tyler (tyler_at_[hidden])
Date: 2013-04-22 02:52:27
oHello all:
I'm kind of at a loss here. It looks like ther'es an issue with
boost::bind somewhere in the mess of 500 templates and 90 screens of
errors and I don't know enough about the mess to untangle it. Any info
would be awesome. First, the code:
sgroup->AddEntry(new OlcStringEntry("name", "Sets the name of the
object", OF_NORMAL,
boost::bind(&StaticObject::GetName, _1),
<159> boost::bind(&StaticObject::SetName, _1, _2)));
the 159 I denoted is useful in the errors later.
Now the rest of the code I'm using:
typedef boost::function<std::string ()> StringGetter;
typedef boost::function<void (const std::string&)> StringSetter;
class IOlcEntry
{
protected:
std::string _name;
std::string _help;
FLAG _flag;
public:
IOlcEntry(const std::string &name, const std::string &help, FLAG flag)
{
_flag = flag;
_name = name;
_help = help;
}
~IOlcEntry() {}
};
class OlcStringEntry:public IOlcEntry
{
protected:
StringGetter _getter;
StringSetter _setter;
public:
OlcStringEntry(const std::string &name, const std::string &help, FLAG
flag, const StringGetter getter, const StringSetter setter)
:IOlcEntry(name, help, flag)
{
_setter = setter;
_getter = getter;
}
};
and here is the novel of errors:
02:45:56: Compiling staticObject.cpp.
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp: In instantiation of R
boost::_bi::list1<A1>::operator()(boost::_bi::type<R>, F&, A&, long int)
[with R = std::basic_string<char>; F =
boost::_mfi::cmf0<std::basic_string<char>, BaseObject>; A =
boost::_bi::list0; A1 = boost::arg<1>]:
/usr/local/include/boost/bind/bind_template.hpp:20:59: required from
boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F,
L>::operator()() [with R = std::basic_string<char>; F =
boost::_mfi::cmf0<std::basic_string<char>, BaseObject>; L =
boost::_bi::list1<boost::arg<1> >; boost::_bi::bind_t<R, F,
L>::result_type = std::basic_string<char>]
/usr/local/include/boost/function/function_template.hpp:132:42: required
from static R
boost::detail::function::function_obj_invoker0<FunctionObj,
R>::invoke(boost::detail::function::function_buffer&) [with FunctionObj
= boost::_bi::bind_t<std::basic_string<char>,
boost::_mfi::cmf0<std::basic_string<char>, BaseObject>,
boost::_bi::list1<boost::arg<1> > >; R = std::basic_string<char>]
/usr/local/include/boost/function/function_template.hpp:934:60: required
from void boost::function0<R>::assign_to(Functor) [with Functor =
boost::_bi::bind_t<std::basic_string<char>,
boost::_mfi::cmf0<std::basic_string<char>, BaseObject>,
boost::_bi::list1<boost::arg<1> > >; R = std::basic_string<char>]
/usr/local/include/boost/function/function_template.hpp:722:7: required
from boost::function0<R>::function0(Functor, typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type) [with Functor = boost::_bi::bind_t<std::basic_string<char>,
boost::_mfi::cmf0<std::basic_string<char>, BaseObject>,
boost::_bi::list1<boost::arg<1> > >; R = std::basic_string<char>;
typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type = int]
/usr/local/include/boost/function/function_template.hpp:1069:16:
required from boost::function<R()>::function(Functor, typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type) [with Functor = boost::_bi::bind_t<std::basic_string<char>,
boost::_mfi::cmf0<std::basic_string<char>, BaseObject>,
boost::_bi::list1<boost::arg<1> > >; R = std::basic_string<char>;
typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type = int]
staticObject.cpp:159:44: required from here
/usr/local/include/boost/bind/bind.hpp:243:60: error: no match for
operator[] in a[boost::_bi::storage1<boost::arg<I> >::a1_<1>]
/usr/local/include/boost/bind/bind.hpp:243:60: note: candidates are:
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp:170:27: note: template<class T>
T& boost::_bi::list0::operator[](boost::_bi::value<T>&) const
/usr/local/include/boost/bind/bind.hpp:170:27: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp:243:60: note: mismatched types
boost::_bi::value<T> and boost::arg<1>()
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp:172:33: note: template<class T>
const T& boost::_bi::list0::operator[](const boost::_bi::value<T>&) const
/usr/local/include/boost/bind/bind.hpp:172:33: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp:243:60: note: mismatched types
const boost::_bi::value<T> and boost::arg<1>()
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp:174:27: note: template<class T>
T& boost::_bi::list0::operator[](const boost::reference_wrapper<T>&) const
/usr/local/include/boost/bind/bind.hpp:174:27: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp:243:60: note: mismatched types
const boost::reference_wrapper<T> and boost::arg<1>()
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp:176:76: note: template<class R,
class F, class L> typename boost::_bi::result_traits<R, F>::type
boost::_bi::list0::operator[](boost::_bi::bind_t<R, F, L>&) const
/usr/local/include/boost/bind/bind.hpp:176:76: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind.hpp:22:0,
from staticObject.cpp:2:
/usr/local/include/boost/bind/bind.hpp:243:60: note: mismatched types
boost::_bi::bind_t<R, F, L> and boost::arg<1>()
/usr/local/include/boost/bind/bind.hpp:178:76: note: template<class R,
class F, class L> typename boost::_bi::result_traits<R, F>::type
boost::_bi::list0::operator[](const boost::_bi::bind_t<R, F, L>&) const
/usr/local/include/boost/bind/bind.hpp:178:76: note: template argument
deduction/substitution failed:
/usr/local/include/boost/bind/bind.hpp:243:60: note: mismatched types
const boost::_bi::bind_t<R, F, L> and boost::arg<1>()
In file included from /usr/local/include/boost/bind/bind.hpp:29:0,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/bind/arg.hpp: In instantiation of
boost::arg<I>::arg(const T&) [with T = boost::arg<2>(); int I = 1]:
/usr/local/include/boost/bind/bind.hpp:313:9: required from void
boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&,
int) [with F = boost::_mfi::mf1<void, BaseObject, const
std::basic_string<char>&>; A = boost::_bi::list1<const
std::basic_string<char>&>; A1 = boost::arg<1>; A2 = boost::arg<2>]
/usr/local/include/boost/bind/bind_template.hpp:47:59: required from
boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F,
L>::operator()(const A1&) [with A1 = std::basic_string<char>; R = void;
F = boost::_mfi::mf1<void, BaseObject, const std::basic_string<char>&>;
L = boost::_bi::list2<boost::arg<1>, boost::arg<2> >;
boost::_bi::bind_t<R, F, L>::result_type = void]
/usr/local/include/boost/function/function_template.hpp:153:11: required
from static void
boost::detail::function::void_function_obj_invoker1<FunctionObj, R,
T0>::invoke(boost::detail::function::function_buffer&, T0) [with
FunctionObj = boost::_bi::bind_t<void, boost::_mfi::mf1<void,
BaseObject, const std::basic_string<char>&>,
boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; R = void; T0 = const
std::basic_string<char>&]
/usr/local/include/boost/function/function_template.hpp:934:60: required
from void boost::function1<R, T1>::assign_to(Functor) [with Functor =
boost::_bi::bind_t<void, boost::_mfi::mf1<void, BaseObject, const
std::basic_string<char>&>, boost::_bi::list2<boost::arg<1>,
boost::arg<2> > >; R = void; T0 = const std::basic_string<char>&]
/usr/local/include/boost/function/function_template.hpp:722:7: required
from boost::function1<R, T1>::function1(Functor, typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type) [with Functor = boost::_bi::bind_t<void,
boost::_mfi::mf1<void, BaseObject, const std::basic_string<char>&>,
boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; R = void; T0 = const
std::basic_string<char>&; typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type = int]
/usr/local/include/boost/function/function_template.hpp:1069:16:
required from boost::function<R(T0)>::function(Functor, typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type) [with Functor = boost::_bi::bind_t<void,
boost::_mfi::mf1<void, BaseObject, const std::basic_string<char>&>,
boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; R = void; T0 = const
std::basic_string<char>&; typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type = int]
staticObject.cpp:159:44: required from here
/usr/local/include/boost/bind/arg.hpp:37:22: error: size of array is
negative
In file included from /usr/local/include/boost/bind/mem_fn.hpp:215:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/bind/mem_fn_template.hpp: In instantiation of
R boost::_mfi::mf1<R, T, A1>::call(U&, const void*, B1&) const [with U
= const std::basic_string<char>; B1 = const std::basic_string<char>; R =
void; T = BaseObject; A1 = const std::basic_string<char>&]:
/usr/local/include/boost/bind/mem_fn_template.hpp:179:42: required from
R boost::_mfi::mf1<R, T, A1>::operator()(const U&, A1) const [with U =
std::basic_string<char>; R = void; T = BaseObject; A1 = const
std::basic_string<char>&]
/usr/local/include/boost/bind/bind.hpp:313:9: required from void
boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&,
int) [with F = boost::_mfi::mf1<void, BaseObject, const
std::basic_string<char>&>; A = boost::_bi::list1<const
std::basic_string<char>&>; A1 = boost::arg<1>; A2 = boost::arg<2>]
/usr/local/include/boost/bind/bind_template.hpp:47:59: required from
boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F,
L>::operator()(const A1&) [with A1 = std::basic_string<char>; R = void;
F = boost::_mfi::mf1<void, BaseObject, const std::basic_string<char>&>;
L = boost::_bi::list2<boost::arg<1>, boost::arg<2> >;
boost::_bi::bind_t<R, F, L>::result_type = void]
/usr/local/include/boost/function/function_template.hpp:153:11: required
from static void
boost::detail::function::void_function_obj_invoker1<FunctionObj, R,
T0>::invoke(boost::detail::function::function_buffer&, T0) [with
FunctionObj = boost::_bi::bind_t<void, boost::_mfi::mf1<void,
BaseObject, const std::basic_string<char>&>,
boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; R = void; T0 = const
std::basic_string<char>&]
/usr/local/include/boost/function/function_template.hpp:934:60: required
from void boost::function1<R, T1>::assign_to(Functor) [with Functor =
boost::_bi::bind_t<void, boost::_mfi::mf1<void, BaseObject, const
std::basic_string<char>&>, boost::_bi::list2<boost::arg<1>,
boost::arg<2> > >; R = void; T0 = const std::basic_string<char>&]
/usr/local/include/boost/function/function_template.hpp:722:7: required
from boost::function1<R, T1>::function1(Functor, typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type) [with Functor = boost::_bi::bind_t<void,
boost::_mfi::mf1<void, BaseObject, const std::basic_string<char>&>,
boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; R = void; T0 = const
std::basic_string<char>&; typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type = int]
/usr/local/include/boost/function/function_template.hpp:1069:16:
required from boost::function<R(T0)>::function(Functor, typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type) [with Functor = boost::_bi::bind_t<void,
boost::_mfi::mf1<void, BaseObject, const std::basic_string<char>&>,
boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; R = void; T0 = const
std::basic_string<char>&; typename
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value,
int>::type = int]
staticObject.cpp:159:44: required from here
/usr/local/include/boost/bind/mem_fn_template.hpp:156:53: error: no
matching function for call to get_pointer(const std::basic_string<char>&)
/usr/local/include/boost/bind/mem_fn_template.hpp:156:53: note:
candidates are:
In file included from /usr/local/include/boost/bind/bind.hpp:25:0,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/ref.hpp:182:29: note: template<class T> T*
boost::get_pointer(const boost::reference_wrapper<T>&)
/usr/local/include/boost/ref.hpp:182:29: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind/mem_fn.hpp:215:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/bind/mem_fn_template.hpp:156:53: note: const
std::basic_string<char> is not derived from const
boost::reference_wrapper<T>
In file included from /usr/local/include/boost/bind/mem_fn.hpp:25:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/get_pointer.hpp:20:23: note: template<class T>
T* boost::get_pointer(T*)
/usr/local/include/boost/get_pointer.hpp:20:23: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind/mem_fn.hpp:215:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/bind/mem_fn_template.hpp:156:53: note:
mismatched types T* and std::basic_string<char>
In file included from /usr/local/include/boost/bind/mem_fn.hpp:25:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/get_pointer.hpp:27:23: note: template<class T>
T* boost::get_pointer(const std::auto_ptr<T>&)
/usr/local/include/boost/get_pointer.hpp:27:23: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind/mem_fn.hpp:215:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/bind/mem_fn_template.hpp:156:53: note: const
std::basic_string<char> is not derived from const std::auto_ptr<T>
In file included from /usr/local/include/boost/bind/mem_fn.hpp:25:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/get_pointer.hpp:34:23: note: template<class T>
T* boost::get_pointer(const std::unique_ptr<T>&)
/usr/local/include/boost/get_pointer.hpp:34:23: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind/mem_fn.hpp:215:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/bind/mem_fn_template.hpp:156:53: note: const
std::basic_string<char> is not derived from const std::unique_ptr<T>
In file included from /usr/local/include/boost/bind/mem_fn.hpp:25:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/get_pointer.hpp:39:23: note: template<class T>
T* boost::get_pointer(const std::shared_ptr<_Tp>&)
/usr/local/include/boost/get_pointer.hpp:39:23: note: template argument
deduction/substitution failed:
In file included from /usr/local/include/boost/bind/mem_fn.hpp:215:0,
from /usr/local/include/boost/mem_fn.hpp:22,
from /usr/local/include/boost/bind/bind.hpp:26,
from /usr/local/include/boost/bind.hpp:22,
from staticObject.cpp:2:
/usr/local/include/boost/bind/mem_fn_template.hpp:156:53: note: const
std::basic_string<char> is not derived from const std::shared_ptr<_Tp>
/usr/local/include/boost/bind/mem_fn_template.hpp:156:53: error:
return-statement with a value, in function returning 'void' [-fpermissive]
make: *** [staticObject.o] Error 1
Thanks in advance,
-- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net