|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-23 12:30:24
From: "Aleksey Gurtovoy" <alexy_at_[hidden]>
> We would love to, but besides educational issues there are also some
> technical problems :(. For example, the following code does not compiles
on
> MSVC6.5:
>
> #include "boost/bind.hpp"
> #include <string>
>
> struct something
> {
> int id() const;
> };
>
> struct to_string
> {
> typedef std::string result_type;
> std::string operator()(int) const;
> };
>
> int main()
> {
> something* s;
> boost::bind(to_string(), boost::bind(&something::id, _1))(s);
> return 0;
> }
>
> And AFAIK it should. The 'to_string()' function object is the main source
of
> troubles here. I haven't got time to look into details of what's happening
> here, though.
It should - and on a real compiler, it does. On MSVC, you need to use the
other syntax:
boost::bind<std::string>(to_string(), boost::bind(&something::id, _1))(s);
This looks like a good candidate for a FAQ entry.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk