オブジェクトを追跡するために使用しているweak_ptrsのリストがあります。ある時点で、shared_ptr または weak_ptr を指定してリストからアイテムを削除したいと考えています。
#include <list>
int main()
{
typedef std::list< std::weak_ptr<int> > intList;
std::shared_ptr<int> sp(new int(5));
std::weak_ptr<int> wp(sp);
intList myList;
myList.push_back(sp);
//myList.remove(sp);
//myList.remove(wp);
}
ただし、上記の行のコメントを外すと、プログラムはビルドされません。
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\list(1194): error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::tr1::weak_ptr<_Ty>' (or there is no acceptable conversion)
shared_ptr または weak_ptr を指定してリストからアイテムを削除するにはどうすればよいですか?