Subject: Re: phoenix lambda-lambda for_each example
From: Aleksey Gurtovoy <[email-masked]>
To: Joel de Guzman <[email-masked]>
Cc: Noah Stein <[email-masked]>, David Abrahams <[email-masked]>, Jaakko Jarvi <[email-masked]>
Date: Wed, 03 Mar 2004 17:07:05 -0600

Joel de Guzman writes:
> Aleksey Gurtovoy wrote:
>> We can easily have both. Or 'outer(arg1)' as a synonym for
>> outer<1>(arg1)',
>> and "numbered" versions only for greater scopes.
>
> Can you do that? 

Sure:

    // outer(arg1)
    template< int n >
    outer_argument<1,n> outer(arg<n>);

    // outer(... outer(arg1))
    template< int scope, int n >
    outer_argument<scope+1,n> outer(outer_argument<scope,n>);

    // outer<n>(arg1)
    template< int scope, int n >
    outer_argument<scope,n> outer(arg<n>);

> Or do you mean outer<>(arg1)?

Nope; besides, that's not possible -- function templates are not
allowed to have default template parameters.

>
> Perhaps we can elide the <N> since, I imagine, practically, only a
> few outer scopes, say, 1..10 are needed:
>
>      outer(_1)
>      outer2(_1) == outer(outer(_1))
>      outer3(_1) == outer(outer(outer(_1)))
>
> ??

I like parametrized versions better.

-- 
Aleksey Gurtovoy
MetaCommunications Engineering