|
exkarion 님이 쓰신 글 :
: set1 의 선언부에서 에러가 나네요....
:
: greater<int>()를 넣으니 타입이 매칭되지 않는다고 나오는군요...
:
: #include <iostream>
: #include <cstdlib>
: #include <algorithm>
: #include <iterator>
: #include <set>
: #include <functional>
: using namespace std;
:
: int main()
: {
: int init[] = { 1,2,3,4,5,6,7,8,9,0 };
역순으로 정렬하려면,
: set<int> set1( &init[0], &init[10], greater<int>() );
가 아니라
set<int, greater<int> > set1( &init[0], &init[10] );
로 해야 합니다.
: ostream_iterator<int> out( cout, " " );
: copy( set1.begin(), set1.end(), out );
: cout << endl;
:
: return 0;
: }
:
: 어디가 틀린건가요....좋은답변 기다립니다.
|