W
W Marsh
Hi,
Could anybody tell me wh the parameter "T val" is not marked const in
this Stroustrup code, considering that val is not modified and not non-
const methods called?
template<class C, class T> int count(const C&v, T val)
{
typename C::const_iterator i = find(v.begin(), v.end(), val);
int n = 0;
while (i != v.end()) {
++n;
++i; // skip past the element we just found
i = find(i, v.end(), val);
}
return n;
}
Could anybody tell me wh the parameter "T val" is not marked const in
this Stroustrup code, considering that val is not modified and not non-
const methods called?
template<class C, class T> int count(const C&v, T val)
{
typename C::const_iterator i = find(v.begin(), v.end(), val);
int n = 0;
while (i != v.end()) {
++n;
++i; // skip past the element we just found
i = find(i, v.end(), val);
}
return n;
}