Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2003-10-11 18:17:31


Brian McNamara <lorgon_at_[hidden]> wrote:
> On Sat, Oct 11, 2003 at 08:37:24PM +0300, Peter Dimov wrote:
>> Joel de Guzman wrote:
>>
>>> typedef result_of_plus<int, double>::type result;
>>
>> You should name that
>>
>> typedef result_of<plus(int, double)>::type result;
>>
>> instead. :-)
>
> There is a smiley, but seriously, if you did
>
> struct op_plus {
> template <class R> struct result;
> template <class F, class A1, class A2> struct result<F(A1,A2)> {
> typedef typename result_of_plus<A1,A2>::type type;
> };
> };
> // etc.
>
> then
>
> typedef result_of< op_plus(int, double) >::type result;
>
> would truly work. (Names like op_plus are just used as tags which stand
> for the corresponding C++ operators.)

This is exactly how I envision it to be used. The result_of_plus is just a
low-level utility.

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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