Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-07-27 02:33:09

Eric Friedman wrote:
> What about "delayed metafunction"? The desire to _delay_ the
> application of a metafunction is the reason this metafunction/
> metafunction-class distinction was created in the
> first place. (No?)

No :). You can "delay" a metafunction without turning into a
metafunction-class; basically, any template class that hasn't been
instantiated (and has a nested 'type' member) is a delayed metafunction:

template< typename T1, typename T2 > struct first
    typedef T1 type;

template< typename F > struct apply_delayed
    typedef typename F::type type;

// first<int,long> is a "delayed" metafunction; no reason for implicit
// instantiation yet
typedef apply_delayed< first<int,long> > apply;

// applying delayed metafunction; 'first<int,long>' is instantiated now
typedef apply::type t;

On a slightly aside note, in MPL world a "delayed" metafunction is the same
thing as a nullary metafunction (naturally, if you think of a nullary
metafunction as the metafunction with all the arguments provided).

In any case, "delaying" has very little to do with the concept of
metafunction class, so it's not really an option.


Boost list run by bdawes at, gregod at, cpdaniel at, john at