K
kvnil
Cheers,
I've been struggling all day today with this, maybe you could give me some
useful pointers.
I would like to (elegantly) concatenate a string out of all node values in
a map. I have to do it without using boost (as it is forbidden to use it
in our project).
(Forgive me for giving a non-compiling code.)
---- begin ----
map<int,string> m;
string s;
transform(m.begin(),m.end(),????, select2nd<int,string>());
---- end ----
What would you recommend placing instead of ???? ?
I've an ugly solution where I declare (something like):
vector<string> v;
transform(m.begin(),m.end(), back_inserterer(v), select2nd<int,string>());
and then of course I could build the string out of the vector.
Why can't I do something like:
transform(m.begin(),m.end(),back_inserter(s.begin()), select2nd<int,string>());
Regards
kev
I've been struggling all day today with this, maybe you could give me some
useful pointers.
I would like to (elegantly) concatenate a string out of all node values in
a map. I have to do it without using boost (as it is forbidden to use it
in our project).
(Forgive me for giving a non-compiling code.)
---- begin ----
map<int,string> m;
string s;
transform(m.begin(),m.end(),????, select2nd<int,string>());
---- end ----
What would you recommend placing instead of ???? ?
I've an ugly solution where I declare (something like):
vector<string> v;
transform(m.begin(),m.end(), back_inserterer(v), select2nd<int,string>());
and then of course I could build the string out of the vector.
Why can't I do something like:
transform(m.begin(),m.end(),back_inserter(s.begin()), select2nd<int,string>());
Regards
kev