Блог пользователя CLICKHERE

Автор CLICKHERE, 7 лет назад, По-английски
#include <bits/stdc++.h>
using namespace std;

class a{
	public:
	vector<int> v;
	a(){
		v = {1,2,3};
	}
	bool cmp(const int &a, const int &b){
		return (a < b);
	}
	void fun(){
		sort(v.begin(), v.end(), cmp);
		for(auto x :v ) {
			cout << x;
		}
	}
};

int main() {
	a b;
	b.fun();
}

why it is giving error at sort(v.begin(), v.end(), cmp); ?

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Did you try looking up your error?

Here's one of the results: http://www.programmersought.com/article/5922553195/