- 75 名前:73 mailto:sage [04/12/12 15:19:55]
- すいません、functionalでもgreaterだけは通りました。
lessやless_equal、greater_equalでは駄目みたいです。 >>74 レスありがとうございます。では私の何かやり方がまずいっぽいです。 どうか添削して頂けないでしょうか。 #include <iostream> #include <list> using namespace std; struct func_object{ bool operator()( const int& lhs, const int& rhs ){ return lhs < rhs; } }; int main(){ list<int> list_hage; list_hage.push_back( 5 ); list_hage.push_back( 1 ); list_hage.push_back( 3 ); list_hage.sort( func_object() ); //error: struct func_objectから、struct std::greater<int>に変換できません(VC6) //確認用 for( list<int>::iterator it = list_hage.begin(); it != list_hage.end(); ++it ){ cout << (*it) << endl; } return 0; }
|

|