From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-20 09:05:37
> Hi Peter and others,
Hi Jaako. :-)
> The bind library has taken the route to store the bound arguments as
> except when ref or cref is used, whereas LL tries to make an educated
> whether to store the arguments as references or as copies.
My opinion is that the library should not try to second-guess the
programmer. I outlined some reasons in another post. In short, the library's
guess may be wrong; we have a documented method that requests
store-by-reference - ref() - so I don't think that guessing is justified.
> I see ref and cref are in the bind library now. What was decided on
No, ref/cref are not in Bind, they are in ref.hpp that is intended to be
shared between Bind, Tuple, and whatever other libraries may need it.
For instance, a new-and-improved <algorithm> may accept syntax like
for_each(first, last, &X::f); // atomagically uses mem_fun underneath
for_each(first, last, ref(f)); // uses f, rather than a copy
> Tuples were lifted to boost namespace, and so ref and cref are now in
> and in bind libraries?!
Can't you just #include <boost/ref.hpp> in Tuple? There shouldn't be any
problems with it; after all I lifted it from Tuple. :-)
> Someone asked this same question: why return_type instead of
> Isn't result_type the standard name for adaptable functors? In this
> the user could write say bind(plus<int>(), _1, _2) instead of
> bind<int>(plus<int>(), _1, _2).
Bind will start to support this syntax whenever function template default
arguments make it into the language. bind(f, ...) will then be a shorthand
for bind<typename F::result_type>(f, ...).
> In general, I think bind library is a good temporary solution, I hope
> we will
> eventually go to a full expression template library (LL :),
> offering recursive binding, and binding of operator functions as well,
> and free mixing of these.
I hope so as well. MSVC users however will have to wait until 7.1. :-)
-- 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