Boost logo

Boost :

From: Matt Calabrese (rivorus_at_[hidden])
Date: 2005-08-30 14:32:25

On 8/30/05, Matt Calabrese <rivorus_at_[hidden]> wrote:

> In this case, I guess it's the documentation that must be changed.
> -Matt Calabrese
Actually, I take that back. I believe I was correct in my first post.
Counting by key is how count should be defined for associative containers,
just like it is with STL containers. Don't change the documentation for
count listed in Associative Sequence and map documentation, since counting
by entire element type in a map wouldn't exactly be very useful and wouldn't
be consistent with the STL. I stand by my original statement that it's the
implementation which should be changed, not the documentation. For now, I
can always just use has_key and use that value as a 1 or a 0 for count, but
that doesn't exactly help out since I would like my code to also work with
theoretical associative sequences which can have multiple mapped values per
key, such as with a theoretical ::boost::mpl::multimap. MPL's count should
be like STL's count for associative containers.

Also, as a side note, the templates key_type and value_type are great,
however, can I suggest possibly changing value_type to mapped_type? The
reason being to be consistent with the STL, since an STL container's
value_type for a map would be the pair, while the mapped_type is what would
be the mapped type of the associative sequence. This isn't as big of a deal,
but if you are concerned with consistency, it might be a good idea to change
(or at least add a mapped_type template and leave value_type so that it
doesn't break old code).

-Matt Calabrese

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