Hm, one ide could be to implem´ment your own 'find()', i.e.
template<typename T>
vector<T>::iterator find(vector<T>& v1vector<T>& v2) {
vector<T>::iterator i = v1.begin();
while( i != v1.end()) {
i = find(i,v2.end(), v2.front());
if (distance(i,v2.end()) < v2.size()) break;
vector<T> tmp(i, i + v2.size());
if ( tmp == v2) return i;
}
return v1.end();
}
Main Topics
Browse All Topics





by: jkrPosted on 2007-05-25 at 09:21:12ID: 19158110
Since 'find()' takes an argument of 'T' and not of 'T*', it is kinda the wrong choice for that task.