
"Doug Gregor" <dgregor@cs.indiana.edu> wrote
On Jul 3, 2004, at 4:38 AM, Andy Little wrote:
An example that I think demonstrates the superiority of this:
binary_operation<A,Op,B>::result_type result;
over this:
result_of_plus<A, B>::type result;
in this directory:
In Boost CVS there is an implementation of result_of, which would be used like this:
result_of<Op(A, B)>::type
One issue with calling the functor Op()(a,b); compared to: binary_operation<A,Op,B>()(a,b); is that it appears to limit you to either passing arguments by value or by const reference for all arguments.(without much more specialization) Again I can't be sure this is correct but it seems to be the case . template<template < typename> class Op > struct operator_ { /* ... result type decls members */. template<typename L, typename R> typename result< operator_<Op>(L,R) >::type // Error cant deduce... operator()( typename meta::as_const_argument<L>::type l, typename meta::as_const_argument<R>::type r) //limited to one or other of the following operator()(L const& l, R const & r) operator()(L l, R r) { return binary_operator<L,Op,R>()(l,r); } }; regards Andy Little