【C++】template 統合スレ -- Part6
■ このスレッドは過去ログ倉庫に格納されています
0359デフォルトの名無しさん
05/03/09 18:17:53「stl_function.h:197: error: no match for 'operator<' in '__x < __y'」
とか言われてしまうのですが (g++ 3.3.3)、原因が分かりません。
何がおかしいのでしょうか。
#include <complex>
#include <set>
using namespace std;
bool operator<(const complex<int> &a, const complex<int> &b)
{
return real(a) < real(b) || (real(a) == real(b) && imag(a) < imag(b));
}
int main()
{
set<complex<int> > s;
s.insert(complex<int>(1, 2));
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています