R
red floyd
I have a suggestion for the standard library....
This is sort of a combination of std::transform() and std::for_each().
It applies the binary function to each iterator in [start1, end1), to the
corresponding member of the container beginning with start2. Like for_each(),
it returns the functor.
---
template<typename Iter1, typename InIter2, typename BinaryFunc>
BinaryFunc apply(Iter1 start1, Iter1 end1, InIter2 start2, BinaryFunc func)
{
while (start1 != end1)
{
func(*start1, *start2);
++start1;
++start2;
}
return func;
}
This is sort of a combination of std::transform() and std::for_each().
It applies the binary function to each iterator in [start1, end1), to the
corresponding member of the container beginning with start2. Like for_each(),
it returns the functor.
---
template<typename Iter1, typename InIter2, typename BinaryFunc>
BinaryFunc apply(Iter1 start1, Iter1 end1, InIter2 start2, BinaryFunc func)
{
while (start1 != end1)
{
func(*start1, *start2);
++start1;
++start2;
}
return func;
}