我想在类中使用函数nth_element和我自己的排序函数(它应该可以访问对象的数据)。bool Foo::idxPointCompareX(int a, int b){ for(int i = 0; i < nmbPoints; i++) idxPointList.push_back(i);
stl
//compare an iterator我们在这里所做的就是将两个迭代器比较成一个容器,这种比较就是STL的面包和黄油并且应该对两个const_iterators进行比较。
对于设计良好的STL实现,这正是所发生的事情,但对于其他实现,代码将不会编译。原因是这样的实现将operator== for const_iterators声明为成员函数,