From: Jeremy Siek (jeremy.siek_at_[hidden])
Date: 2006-09-30 22:54:23
On Sep 29, 2006, at 10:25 AM, David Abrahams wrote:
> Joel de Guzman <joel_at_[hidden]> writes:
>> To me it's like, generalizing that something with a wing,
>> a propeller, and all things that comprise an airplane-- is an
>> airplane. No, not necessarily. The presence of these elements
>> do not complete the picture. It can be, say, *just a collection
>> of parts*. Hence, pair<iterator,iterator> is just a collection
>> of 2 iterators, nothing more.
> External, non-intrusive, adaptation of a 3rd party type to make it
> model a particular concept that it doesn't model "inherently" is a
> fundamental generic programming maneuver. I don't see anything
> particularly wrong with making a pair of iterators model Range.
I also agree with Joel's position on airplanes (I misunderstood
what he was saying at first... but yes, a pile of airplane
parts is not an airplane), which is why I've always been in favor
of explicit concept conformance. I see the concept_map declaration
as the final touch that turns the parts into an airplane.
> Jeremy Siek has described cases to me wherein one type can play two
> different roles with the *same* library. For that you need two
> different concept maps, to map the type into its different roles.
> Thus his recent "scoped concept_map" proposal.
Think of a variant of the accumulate function that instead of
having parameters for an initial object and function object, requires
the value_type of the
iterators to be a model of Monoid... which just requires a binary
and an initial object that is an identity with respect to the binary
The type "int" could model Monoid many ways. For example, it could use
"+" for the binary operator and "0" for the initial object. It could
also use "*" for the binary operator and "1" for the initial object.
>> All that being said, I don't care too much either way. It's not
>> a concern of Fusion, AFAICT. Unless, you are asking for std::pair
>> to be removed from the list of supported Fusion sequences?
> Nope. Just raising the point for discussion.
I think the main thing to take away from this is that scoped
concept maps are good. They allow you to have it both ways,
in different parts of your program.
And yes, we could solve the problem by requiring wrappers,
but wrapping stuff is a pain.
Jeremy Siek <siek_at_[hidden]>
Visiting Assistant Professor
Department of Computer Science
University of Colorado at Boulder