I'm trying to call a static function on a member of a vector inside a templated function. But I can't get the code working. I get the error: ‘Do’ is not a member of ‘__gnu_cxx::__alloc_traits >::value_type& {aka A&}’ Any ideas?
struct A {
static void Do() { cout << "Hey.\n"; }
};
template <typename T>
void foo(T* v) {
decltype(v->at(0))::Do();
}
int main() {
vector<A> v;
foo(&v);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire