求助:关于set 的 remove_if()函数
各位:我遇到一个问题想请大家帮忙解决一下。
当我使用:
multiset<triangle> workset;
multiset<triangle>::iterator itEnd = remove_if(workset.begin(), workset.end(), triangleIsCompleted(itVertex, output, vSuper));
报错信息是:/usr/include/c++/4.1.3/bits/stl_algo.h: In function ‘_OutputIterator std::remove_copy_if(_InputIterator, _InputIterator, _OutputIterator, _Predicate) [with _InputIterator = std::_Rb_tree_const_iterator<triangle>, _OutputIterator = std::_Rb_tree_const_iterator<triangle>, _Predicate = vertexIsInCircumCircle]’:
/usr/include/c++/4.1.3/bits/stl_algo.h:1291: instantiated from ‘_ForwardIterator std::remove_if(_ForwardIterator, _ForwardIterator, _Predicate) [with _ForwardIterator = std::_Rb_tree_const_iterator<triangle>, _Predicate = vertexIsInCircumCircle]’
Delaunay.cpp:872: instantiated from here
/usr/include/c++/4.1.3/bits/stl_algo.h:1218: 错误: 将 ‘const triangle’ 作为 ‘triangle& triangle::operator=(const triangle&)’ 的 ‘this’ 实参时丢弃了类型限定
我的复制赋值操作符的定义是:
triangle& triangle::operator=(const triangle& tri)
{
m_Center=tri.m_Center;
m_R=tri.m_R;
m_R2=tri.m_R2;
for (int i = 0; i < 3; i++)
m_Vertices[i] = tri.m_Vertices[i];
return *this;
}
为什么报出这样的错误呢?有谁知道怎么解决吗?
具体大代码可以看我的附件
Delaunay.tar.gz
(8 KB)