
9 Jun
2011
9 Jun
'11
7:04 p.m.
That interface is restrictive. Why not take iterators and ranges for input and output iterators for output. That would grant greater flexibility to source and destination: your code would be captured as algorithms.
Rob Stewart robert.stewart@sig.com
Yes, Rob, iterators are more flexible, but this flexibility is not always necessary. For example, we can write: std::vector< int > v{ 1, 2, 3 }; auto it = std::find( v.begin(), v.end(), 2 ); But Boost.Range provides "less flexible" solution: std::vector< int > v{ 1, 2, 3 }; auto it = boost::range::find( v, 2 ); IMO, this solution is much easier and safer, but less flexible. - Denis