J
JohanS
Hi
count(v.begin(), v.end(), 5) is easy for a vector of int's.
But how do i make it work with a class object? I have tried a few ways
but can't get it to work since i don't really understand how this
stuff works yet.
If i have class A with 2 int members that you get with A.x() and A.y()
and i want to use count or count_if if A.y() == value.
I have found out how to call member functions with for_each(v.begin(),
v.end(), mem_fun_ref(&A::y)). But this still doesn't solve my problem.
Help please
count(v.begin(), v.end(), 5) is easy for a vector of int's.
But how do i make it work with a class object? I have tried a few ways
but can't get it to work since i don't really understand how this
stuff works yet.
If i have class A with 2 int members that you get with A.x() and A.y()
and i want to use count or count_if if A.y() == value.
I have found out how to call member functions with for_each(v.begin(),
v.end(), mem_fun_ref(&A::y)). But this still doesn't solve my problem.
Help please