1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
#include <deque>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <vector>
#include <map>
using namespace std;
template<class T>struct Out{
ostream & out;
Out(ostream & o):out(o){}
void operator()(const T & val){out<<val<<" ";}
};
int main(){
int t[]={1,1,2,2,3,3,4,4,5,5};
vector<int>v1(t,t+10);
sort(v1.begin(),v1.end(),greater<int>());
cout<< min_element(v1.begin(),v1.end()); // my compiler says I have an error on this line, but I don't know what the error is. I was expecting the output to be the smallest value in the array, which is 1.
//It was not the case. What is wrong with this line?
return 0;
}
| |