Afficher un message
Vieux 15/10/2007, 20h09   #1
webinfinite@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Template and function pointer question

This is my first post here, please tell me if I did anything wrong.

in the following code snippet:
1. template <class In, class Pred>
2. In find_if(In begin, In end, Pred f) {
3. while (begin != end && !f(*begin))
4. ++begin;
5. return begin;
6. }

7. bool is_negative(int n) {
8. return n < 0;
9. }

10. vector<int>::iterator i = find_if(v.begin(), v.end(),
is_negative);

find_if is the template needs a class Pred as its third argument but
in line 10's function call, it takes a function poniter is_negative,
does that mean in C++, function point is equivalent to class?

Thank you.

  Réponse avec citation
 
Page generated in 0,04211 seconds with 9 queries