Re: copy from keys from multimap into the vector
On Oct 30, 3:40 am, puzzlecracker <ironsel2...@gmail.com> wrote:
Given that the while loop solution only requires 2 lines of
code, I think it's the easier solution... ;)
That's exactly my point. Guys, do you see how this solution
is verbose, cluttered, and not particularly expressive over my
traditional solution? Meyers allegedly encourages to use
transforms, copy and other algorithms in the STL library. And
I am confident that for this problem, he would still pick a
stl-like solution. However, using transform, in this case,
doesn't telegraph your intent
It doesn't. You're transforming the values of a map into
strings (or whatever).
This merits a half a :-). I actually agree with you. But
mainly because despite the contortions of the standard library;
a map conceptually isn't a "container" of objects, but has keys
and values. And you don't want to transform the keys, just copy
them. If you think of a map as a container of key-value pairs,
which is how the standard library views it, then you are
transforming a key-value pair into a key.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34