【发布时间】:2015-11-17 07:28:06
【问题描述】:
我有通过开始和结束接受容器的功能:
template <class Titerator> int foo(const Titerator& begin_data, const Titerator& end_data);
在这个函数中我想做一些类似的事情:
While there is reaming data{
Do something on the remaining data
delete some of the remaining data that satisfied a condition
}
当然铰孔数据是原始数据的副本(原始数据不会改变)
我想不出办法。我需要复制数据,这样我就可以在上面做任何我想做的事情,但是当我不知道容器是什么时如何复制它?它是向量、列表还是什么?我只有开头和结尾。 如何在不丢失通用概念的情况下定义此功能?
【问题讨论】:
-
我建议重命名模板参数...
-
如果你不介意可以告诉我:建议什么以及为什么?
-
这是reason。
标签: c++ templates c++11 iterator