Boost logo

Boost Users :

From: BRIDGES Dick (Dick.Bridges_at_[hidden])
Date: 2005-10-05 11:59:11


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Peter Dimov
> Sent: Tuesday, October 04, 2005 3:49 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [bind] Member fn has defeated me
>
>
> BRIDGES Dick wrote:
>
> > class Bar {
> > typedef void (*pf)(bool);
>
> If you make this
>
> typedef boost::function<void(bool)> pf;
>
[snip]
>
> then
>
> Bar bar_( boost::bind(&X::f, &x) );
>
> should work. But you can't get an oridnary function pointer from
> boost::bind; a function pointer doesn't have enough state to
> represent &X::f
> + &x.

<error_message>

Building file: ../main.cpp
g++ -D_REENTRANT -I/boost_1_33_0 -O0 -g3 -Wall -c -
fmessage-length=0 -omain.o ../main.cpp
/boost_1_33_0/boost/bind.hpp: In instantiation of
?boost::_bi::result_traits<boost::_bi::unspecified, void
(X::*)(bool)>?:
/boost_1_33_0/boost/bind/bind_template.hpp:15:
instantiated from
?boost::_bi::bind_t<boost::_bi::unspecified, void
(X::*)(bool), boost::_bi::list1<boost::_bi::value<X*> > >?
../main.cpp:197: instantiated from here
/boost_1_33_0/boost/bind.hpp:63: error: ?void (X::*)(bool)?
is not a class, struct, or union type
/boost_1_33_0/boost/bind/bind_template.hpp: In
instantiation of
?boost::_bi::bind_t<boost::_bi::unspecified, void
(X::*)(bool), boost::_bi::list1<boost::_bi::value<X*> > >?:
../main.cpp:197: instantiated from here
/boost_1_33_0/boost/bind/bind_template.hpp:15: error: no
type named ?type? in ?struct
boost::_bi::result_traits<boost::_bi::unspecified, void
(X::*)(bool)>?
...
[previous line repeated 23 times - increasing __LINE__]
...
/boost_1_33_0/boost/function/function_template.hpp: In
static member function ?static void
boost::detail::function::void_function_obj_invoker1<Functio
nObj, R, T0>::invoke(boost::detail::function::any_pointer,
T0) [with FunctionObj =
boost::_bi::bind_t<boost::_bi::unspecified, void
(X::*)(bool), boost::_bi::list1<boost::_bi::value<X*> > >,
R = void, T0 = bool]?:
/boost_1_33_0/boost/function/function_template.hpp:479:
instantiated from ?void boost::function1<R, T0,
Allocator>::assign_to(FunctionObj,
boost::detail::function::function_obj_tag) [with
FunctionObj = boost::_bi::bind_t<boost::_bi::unspecified,
void (X::*)(bool), boost::_bi::list1<boost::_bi::value<X*>
> >, R = void, T0 = bool, Allocator =
std::allocator<void>]?
/boost_1_33_0/boost/function/function_template.hpp:430:
instantiated from ?void boost::function1<R, T0,
Allocator>::assign_to(Functor) [with Functor =
boost::_bi::bind_t<boost::_bi::unspecified, void
(X::*)(bool), boost::_bi::list1<boost::_bi::value<X*> > >,
R = void, T0 = bool, Allocator = std::allocator<void>]?
/boost_1_33_0/boost/function/function_template.hpp:294:
instantiated from ?boost::function1<R, T0,
Allocator>::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<boost::_bi::unspecified,
void (X::*)(bool), boost::_bi::list1<boost::_bi::value<X*>
> >, R = void, T0 = bool, Allocator =
std::allocator<void>]?
/boost_1_33_0/boost/function/function_template.hpp:638:
instantiated from ?boost::function<R ()(T0),
Allocator>::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<boost::_bi::unspecified,
void (X::*)(bool), boost::_bi::list1<boost::_bi::value<X*>
> >, R = void, T0 = bool, Allocator =
std::allocator<void>]?
../main.cpp:197: instantiated from here
/boost_1_33_0/boost/function/function_template.hpp:136:
error: no match for call to
?(boost::_bi::bind_t<boost::_bi::unspecified, void
(X::*)(bool), boost::_bi::list1<boost::_bi::value<X*> > >)
(bool&)?
make: *** [main.o] Error 1
</error_message>

Peter,

Your suggestion sure made sense. I clearly did something wrong
but can't figure out what that would be. I must be interpreting
the error message incorrectly. I interpret it to say that the
compiler can't find the definition of X but

  X x;
  x.f(true);

compiles without any problem. Where should I be looking?

Regards,
Dick


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