Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-23 07:53:32


From: "Johan Nilsson" <johan.nilsson_at_[hidden]>
> Thanks for the reply,
>
> I tried the following:
>
> ---
>
> std::locale defaultLocale;
> bool (*pIsSpace)(char, const std::locale&) = &std::isspace;
>
> std::string::iterator nonSpace = std::find_if(stringToTrim.begin(),
> stringToTrim.end(),
> boost::bind<bool>(std::logical_not<bool>(),
> boost::bind<bool>(pIsSpace, _1, defaultLocale)));
>
> ---
>
> But only got "error C2667: 'boost::bind' : none of 38 overloads have a
best
> conversion" etc ...

You only need bind<bool> on the outer bind, as it uses a function object.
The inner bind uses a function pointer, and there is no need to pass a type.

http://www.boost.org/libs/bind/bind.html#Q_forms
http://www.boost.org/libs/bind/bind.html#err_short_form
http://www.boost.org/libs/bind/bind.html#err_long_form

On a more capable compiler, even the outer bind doesn't need the <bool> as
it will automatically extract the return type from the ::result_type nested
typedef, but MSVC 7 can't do that.


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