Boost logo

Boost Users :

From: Barchenkov, Alexei \(IT\) (Alexei.Barchenkov_at_[hidden])
Date: 2007-03-23 12:54:45


I am getting an error when compiling the following code on gcc32. Could
someone please point out what is the problem? Thank you.
 
class Test { };
 
template <class T>
void foo(T arg_) { }
 
template <class T>
void fooRef(const T& arg_){ }
 
int main(int)
{
  Test t;
  boost::reference_wrapper<Test> tr(t);
  boost::function<void()> fun1 =
boost::bind(&::foo<boost::reference_wrapper<Test> >, tr); // line
41
  boost::function<void()> fun2 =
boost::bind(&::fooRef<boost::reference_wrapper<Test> >, tr); // line 42
}
 
....
 
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/bind.hpp: In member
   function `void
boost::_bi::list1<A1>::operator()(boost::_bi::type<void>, F&,
   A&, int) [with F = void (*)(boost::reference_wrapper<Test>), A =
   boost::_bi::list0, A1 = boost::reference_wrapper<Test>]':
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/bind/bind_template.h
pp:20: instantiated from `boost::_bi::result_traits<R, F>::type
boost::_bi::bind_t<R, F, L>::operator()() [with R = void, F = void
(*)(boost::reference_wrapper<Test>), L =
boost::_bi::list1<boost::reference_wrapper<Test> >]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:136: instantiated from `static void
boost::detail::function::void_function_obj_invoker0<FunctionObj,
R>::invoke(boost::detail::function::any_pointer) [with FunctionObj =
boost::_bi::bind_t<void, void (*)(boost::reference_wrapper<Test>),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:479: instantiated from `void boost::function0<R,
Allocator>::assign_to(FunctionObj,
boost::detail::function::function_obj_tag) [with FunctionObj =
boost::_bi::bind_t<void, void (*)(boost::reference_wrapper<Test>),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void,
Allocator = std::allocator<void>]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:430: instantiated from `void boost::function0<R,
Allocator>::assign_to(Functor) [with Functor = boost::_bi::bind_t<void,
void (*)(boost::reference_wrapper<Test>),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void,
Allocator = std::allocator<void>]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:294: instantiated from `boost::function0<R,
Allocator>::function0(Functor,
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functo
r>::value>::value, int>::type) [with Functor = boost::_bi::bind_t<void,
void (*)(boost::reference_wrapper<Test>),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void,
Allocator = std::allocator<void>]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:638: instantiated from `boost::function<R ()(),
Allocator>::function(Functor,
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functo
r>::value>::value, int>::type) [with Functor = boost::_bi::bind_t<void,
void (*)(boost::reference_wrapper<Test>),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void,
Allocator = std::allocator<void>]'
test10.C:41: instantiated from here
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/bind.hpp:229:
conversion
   from `Test' to non-scalar type `boost::reference_wrapper<Test>'
requested
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/bind.hpp: In member
   function `void
boost::_bi::list1<A1>::operator()(boost::_bi::type<void>, F&,
   A&, int) [with F = void (*)(const boost::reference_wrapper<Test>&), A
=
   boost::_bi::list0, A1 = boost::reference_wrapper<Test>]':
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/bind/bind_template.h
pp:20: instantiated from `boost::_bi::result_traits<R, F>::type
boost::_bi::bind_t<R, F, L>::operator()() [with R = void, F = void
(*)(const boost::reference_wrapper<Test>&), L =
boost::_bi::list1<boost::reference_wrapper<Test> >]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:136: instantiated from `static void
boost::detail::function::void_function_obj_invoker0<FunctionObj,
R>::invoke(boost::detail::function::any_pointer) [with FunctionObj =
boost::_bi::bind_t<void, void (*)(const
boost::reference_wrapper<Test>&),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:479: instantiated from `void boost::function0<R,
Allocator>::assign_to(FunctionObj,
boost::detail::function::function_obj_tag) [with FunctionObj =
boost::_bi::bind_t<void, void (*)(const
boost::reference_wrapper<Test>&),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void,
Allocator = std::allocator<void>]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:430: instantiated from `void boost::function0<R,
Allocator>::assign_to(Functor) [with Functor = boost::_bi::bind_t<void,
void (*)(const boost::reference_wrapper<Test>&),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void,
Allocator = std::allocator<void>]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:294: instantiated from `boost::function0<R,
Allocator>::function0(Functor,
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functo
r>::value>::value, int>::type) [with Functor = boost::_bi::bind_t<void,
void (*)(const boost::reference_wrapper<Test>&),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void,
Allocator = std::allocator<void>]'
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/function/function_te
mplate.hpp:638: instantiated from `boost::function<R ()(),
Allocator>::function(Functor,
boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functo
r>::value>::value, int>::type) [with Functor = boost::_bi::bind_t<void,
void (*)(const boost::reference_wrapper<Test>&),
boost::_bi::list1<boost::reference_wrapper<Test> > >, R = void,
Allocator = std::allocator<void>]'
test10.C:42: instantiated from here
/ms/dist/fsf/PROJ/boost/1.33.1/common/include/boost/bind.hpp:229: could
not
   convert `(+a)->boost::_bi::list0::operator[](const
   boost::reference_wrapper<T>&) const [with T = Test](this)' to `const
   boost::reference_wrapper<Test>&'
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.



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