find in <algorithm>

Hello. I am quite confused with the "find" function in <algorithm>.
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 <list>
#include <algorithm>
#include <string>

using namespace std;

struct here
{
	int name;
	string add;
};

int main()
{
	list<here> a;
	here an, bn;
	an.name = 123;
	an.add = "aldhfal";
	bn.name = 222;
	bn.add = "alkdhflahf";
	a.push_back(an);
	a.push_back(bn);
	list<here>::iterator k, s;
	k = find(a.begin(), a.end(), an);
        s = a.front();
}

Neither the last nor the second last statement appear to be normal. What is the matter?

Thanks in advance!
When you say "not normal", do you mean that they don't compile?
The last statement is wrong because front() method returns a here&. To get an iterator, use begin(). I don't know what's wrong with line 25. What are the errors?
In order to use 'here' in find() it needs an 'bool operator==(const here &h) const' in 'here' otherwise find() does not know how to compare instances of 'here'
Thanks coder777 and hamsterman! Combining your suggestions, I can now run the code!
Topic archived. No new replies allowed.