P
persres
Hi,
I need to do the following. I really feel I should be able to
do it using some existing standard functionals either in boost or stl.
Does anyone have suggestions.
template <class T>
struct maxif : binary_function<int, int, void>
{
void operator() (const int&s, int& d) const
{
if (d < s)
d = s;
}
};
void UpdateIfLessThanVal(vector<int> v, const int val)
{
for_each(v.begin(), v.end(), bind1st(maxif <int> (), val) );
}
I need to do the following. I really feel I should be able to
do it using some existing standard functionals either in boost or stl.
Does anyone have suggestions.
template <class T>
struct maxif : binary_function<int, int, void>
{
void operator() (const int&s, int& d) const
{
if (d < s)
d = s;
}
};
void UpdateIfLessThanVal(vector<int> v, const int val)
{
for_each(v.begin(), v.end(), bind1st(maxif <int> (), val) );
}