|
Boost : |
From: Vesa Karvonen (vesa_karvonen_at_[hidden])
Date: 2002-04-10 14:43:27
Douglas Gregor:
>If the Romans are Haskell or Ocaml programmers, they may very well be
>appalled at MPL's use of iterators because iteration is abominable in
>functional languages.
Haskell and Ocaml programmers use "iterators", too. Of course, the term
"iterator" doesn't refer to a C++ iterator, but to a functional iterator.
Most functional programming languages do not have an abstract representation
of a sequence in their standard library. Instead, different iterator
functions are used for different type of sequences. This naturally means
that the iterator functions are duplicated for each sequence representation,
which is not quite ideal.
MPL goes a bit further and abstracts the way a sequence is manipulated. I
think that this is basically a good thing, but I'm not sure that I agree
with the exact design of the sequence abstraction. I see little value in
having begin and end iterators. In my experience they are rarely needed. At
least 90% of the time, a sequence is just iterated from start to finish. It
is possible to support ranged operations using an interface that doesn't
complicate the common case.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk