Re: [Boost-users] converting value before inserting into a list
20 Sep
2006
20 Sep
'06
5:11 p.m.
Hello. David Walthall wrote:
Flex Ferrum wrote:
map
m; vector<int> a,b; std::transform(a.begin(), a.end(), std::back_inserter(b), var(m)[_1]);
Is this a case where transform is not appropriate? My understanding is that the operation supplied to transform must not have any side effects, and here m may be modified by operator[]. Does this count as a side effect?
Yes, of course, map::operator[] _can_ have side effects. But if author of such code absolutely sure what each value from source vector has corresponded map entry then map::operator[] will not have side effects and will suitable for transormation operation. ____________ Best Regards Flex
6626
Age (days ago)
6626
Last active (days ago)
0 comments
1 participants
participants (1)
-
Flex Ferrum