Boost logo

Boost :

From: Douglas Gregor (dgregor_at_[hidden])
Date: 2007-11-06 09:56:33


On Tue, 2007-11-06 at 13:41 +0000, AlisdairM wrote:
> Peter Dimov wrote:
>
> > reference_wrapper::operator() needs result_of, and result_of would
> > likely introduce a dependency into Boost.Bind on the PP library, the
> > MPL, type traits, and everything underneath. The change may be worth
> > it even at this cost, but it's not a no-brainer. It might be nicer if
> > we could devise a way to deliver this functionality in a cost-free
> > manner though, perhaps only in tr1::reference_wrapper?
>
> One 'cheap' solution might be to enable it for compilers implementing
> C++0x features.
>
> For instance, decltype and variadic templates would appear to solve
> most the dependency dependency and PP problems

Life will be better with 0x:

  template<typename... Args>
  auto operator()(Args&&... args) const
    -> decltype(get()(std::forward<Args>(args)...)
  {
    return get()(forward<Args>(args)...);
  }

Doesn't solve the unary_function/binary_function issue you brought up,
but it's a lot simpler than the C++98 version :)

  - Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk