Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-08-31 15:19:11

on Sun Aug 31 2008, Arno Schödl <> wrote:

>> // Gimme a better name, please! The abstraction is a thing that
>> // is always used in pairs, where each instance contains some
>> // redundant information in common.
>> auto concept Factorable<typename T>
>> {
>> typename common_data = void;
>> typename unique_data = T;
>> common_data common(T) {}
>> unique_data unique(T x) { return x; }
>> T reconstruct(common_data, unique_data x) { return x; }
>> };
> How is the separation of common_data and unique_data different from a separation
> of ranges and iterators? If iterators of ranges can rely on their range to
> exist, this is where common data like functors, end iterators etc. can be
> stored.

Naturally the point is to store the common data once when you need to
store more than one iterator to the same sequence -- in a range, for

If you're asking why I bother reconstituting the whole iterator out of
its parts, instead of simply referring to the common_data stored in the
range: an adapted iterator is a useful concept regardless of whether
anyone is using a range abstraction.

Dave Abrahams
BoostPro Computing

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