Boost logo

Boost :

Subject: Re: [boost] compile-time for-loop
From: klaus triendl (klaus_at_[hidden])
Date: 2009-09-02 05:04:32

"joel" <joel.falcou_at_[hidden]> schrieb im Newsbeitrag
> klaus triendl wrote:
>> I wonder whether a compile-time for-loop is useful enough so that it
>> would
>> get included in the mpl library;
>> it's very similar to what fold does but it can be used for computations
>> with
>> types other than sequence containers.
> Well, fold is far more generic than for. I can't see, in a
> meta-programming context where side-effects don't occur, when having for_
> is needed when we have fold_.

fold expects a sequence container; I don't see how I can use fold if I don't
have one - see the cross_total metafunction in my initial posting.
Like one can't use std::for_each or std::accumulate in every situation - or
the usage would get complicated at least -, for_ has its purpose, I think.


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