Several STL algorithms have the general form:
Algorithm(InputIterator first1, InputIterator last1, OutputIterator result,...)
or
Algorithm(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result,...)
My question is - when can the OutputIterator result
be in the range (first1,last1)
or (first2,last2)
?
For transform
the answer I found here: http://www.cplusplus.com/reference/algorithm/transform/
But there are multiple others that may make sense, e.g. set_difference
should theoretically be safe for such a usage and also it works in code with GCC 4.7.1.
Any references?