Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-07-13 09:52:29


From: "Douglas Gregor" <gregod_at_[hidden]>
> On Tuesday 10 July 2001 09:38, you wrote:
> > I've updated bind.hpp. It now supports member function pointers and
> > accept()s visitors. :-)
>
> A few comments/questions:
>
> - BOOST_BIND: why? Is this a workaround for MSVC?

Yes. function.hpp indirectly includes type_traits/conversion_traits.hpp. It
contains a nested class template named 'bind'. This breaks the

boost::bind<R>(f, ...);

syntax under MSVC.

There are two workarounds:

1. Rename the nested 'bind' class template to something like 'bind_17' or
'inner'.
2. #define BOOST_BIND to something other than 'bind' and use that instead.

I prefer (1), but if the maintainers of the other libraries that use 'bind'
as a common name for a nested class template don't want to change their
implementations, (2) remains an option.

> - accept(): The code invokes the visitor with the bare a1, a2, etc. This
> means the the visitor may see ref_t<T> or value<T> arguments. Is this
> intended behavior?

Yes. See bind_test_4.cpp. This allows you to handle references differently.

> If so, ref_t<T> and value<T> must be specified as part of
> the visitor concept.

Only if your visitor intends to handle them. The 'accept' member is
primarily to support integration with other libraries, not for the end user.

--
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