From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-03-02 17:10:21
"Powell, Gary" <powellg_at_[hidden]> wrote in message
> This library is an interesting concept but when I looked in it, it
didn't have what I would have thought were "container traits" the way
I think of "iterator traits". From the VTL library I wanted to be able
to query the container to see if it was an associative container, or a
sequence container or a random access container, i.e. had an
> Can one of the authors explain the purpose of this library?
Thorsten Ottosen is the authorative source on this point, but I think
the library is mostly to provide support for algorithms which treat
standard constainers, built-in arrays and iterator ranges uniformly.
(I'm leaving out one case.)
I, too, would like traits of the type you suggest, and I wish they
would be added to the library.
One problem, of course, is that theoretcially you could have a type
which look like a container, because of its member types, but doesn't
have the correct semantics. Also, the amount of introspection required
to be reasonably sure you have a container has some compile-time cost.
I think these problems are negligible if the traits are named and
documented with these considerations in mind. Probably I've been
reading the FC++ docs too much recently, but one might call them
'maybe_is_container', 'maybe_is_sequence', ... ;-)
I think there should at least be traits for detecting standard
container types (is_basic_string, is_vector, is_standard_sequence).
One problem is that you might end up including the whole STL just to
define these traits.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk