是否有像 std::for_each 这样的函数直接传递迭代器而不是取消引用它们的结果?
我们有什么
std::vector<int> ints;
std::for_each(ints.begin(), ints.end(),
[](int i)
{
//how to get the iterator of this element???
}
我在寻找什么
for_each_iterator(ints.begin(), ints.end(),
[](const std::vector<int>::const_iterator &i)
{
//we know the iterator here
}
当然,编写这样一个函数相当简单,但我想问是否存在来自 的标准解决方案std::
,std::tr1::
或者boost::