Jon Stewart on 15 Aug 2003 16:55:02 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: FW: [ALACPP] bound for success!


> Correct me if I'm wrong, but isn't this exactly what std::transform is
> designed to let you do?  So you'd want something like:
> 
> std::transform(mySourceVect.begin(),
> 			mySourceVect.end(),
> 			std::back_inserter(myDestVect),*
> 			boost::bind(&aTransformationFunction, _1));
> 
> * I don't remember exactly what the back insertion syntax is for a
> vector.


Jason is spot on here.

Chris, you want std::accumulate, which can templated off any binary 
operation and uses input iterators -- very general. (Although, since it's 
C++, it still isn't going to be pretty. Suppose you eat quiche, and 
suppose you are a SmallTalker... but I repeat myself.)

A moment of silence for list lurker Bill Williams as he heads off for 
Texas today.



Jon
-- 
Jon Stewart                                 Advanced Los Angeles C++
stew1@xxxxxxxxxxx                           http://www.alacpp.org
_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp