overload vector find

I have this programm, but says me :


test.cpp:22:43: error: no matching function for call to ‘find(std::vector<std::vector<double> >::iterator, std::vector<std::vector<double> >::iterator, std::vector<double>&)’


I think I have to overload the operator, but I don't know exactly where and how to do it.

Someone can tell me?
Thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <vector>

int main ()
{
	std::vector< std::vector<double> > vec;
	
	
	std::vector<double> p;
	p.push_back(1);
	p.push_back(2);
	p.push_back(3);
	
	vec.push_back(p);
	
	std::vector<double> p1;
	p1.push_back(1);
	p1.push_back(2);
	p1.push_back(3);
	
	if ( std::find(vec.begin(), vec.end(), p1) != vec.end())
		cout << "Found" << endl;
	else
		cout << "NULL" << endl;

  return 0;
}
Last edited on
You shall include header <algorithm>
Topic archived. No new replies allowed.