|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-08-12 03:17:08
>From: "Paul Mensonides" <pmenso57_at_[hidden]>
> From: "David Abrahams" <dave_at_[hidden]>
>
> > > In order to work with different type sequences from other places,
those
> > type
> > > sequences will still need to be modified.
> >
> > That's not my understanding at all. AFAIK, you can just specialize the
> > begin<> and end<> metafunctions to produce iterators. Care to explain
what
> > you mean?
>
> That is what I mean. You have to provide the iterators, and that is
intrusive.
> Nevertheless, that isn't really a big deal. I don't think that this is
> necessarily a worthwhile goal on philosophical grounds. Template
> metaprogramming is still in its infancy. As of right now, we still have a
> reasonably chance at uniformity. Specifically designing the library to be
> easily adaptable to alternate implementations of the same thing certainly
> doesn't encourage uniformity.
As Dave pointed out, too, why would uniformity be an advantage? Isn't one
for the advantages for the iterator consept at STL that you may use it with
anything that provides iterators, including things like generators?
If you go for a uniform way, that means people have to agree on a uniform
way. So far, there haven't been any compelling reasons for exclusively
selecting one sequence compared to another, which you have pointed out, too,
as they vary in their behaviour, which is yet another reason for not fixing
it to a specific sequence. Especially as the field is quite new, as you say,
you don't want to standardise on something, to not make a decision that
later turns out to be bad.
So I think the argument that this is a new field, actually works against
fixing the framework to things like specific sequences.
In addition, you have the mentioned advantages that David B. Held and others
have pointed out, that with the iterator abstraction, anything providing
iterators may be used for the algorithms, that includes things like
generators, too. range_c works like that. Are you disregarding this, as
well?
In my opinion, this is a strong argument for the iterator abstraction. It
enables extension and experimentation, in this new, exciting field. MPL
would be much less extensible, if algorithms and functions only worked for a
fixed set of sequences, that couldn't be extended.
By the way, I later found that the example program I posted (sequence
timing), used the typeof() of g++, a non-standard extension. Doing some
simple testing on MSVC 6.0 (which doesn't have typeof()), vector and list
came out equally fast.
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk