hmmm thats very odd...its still giving me this error in g++
Code:
Segmentation fault (core dumped)
i had to re-write the function to make it work
the following works fine
Code:
template<class T>
vector<T> merge(const vector<T> &c1, const vector<T> &c2) {
vector<T> final;
copy(c1.begin(), c1.end(), back_inserter<vector<T > >(final));
for(typename vector<T>::const_iterator i = c2.begin(); i!=c2.end(); ++i) {
if(!binary_search(final.begin(),final.end(),*i))
final.push_back(*i);
}
return final;
}
Anyone got an suggestions on how to make my orignal code work on g++...?