Why doesn't C++ find template function?
Why do I get the compile error no matching function for call to `f(
__gnu_cxx::__normal_iterator > >)'?
#include <vector>
template<typename T>
void f(const typename std::vector<T>::iterator &) {}
void g() {
std::vector<int> v;
f<int>(v.end()); // Compiles.
f(v.end()); // Doesn't compile, gcc 4.3 can't find any match.
}
Ultimately I want to write a function which takes only a vector iterator,
and fails to compile (with a meaningful error) for anything else.
No comments:
Post a Comment