dimanche 6 mars 2022

c++ template: error expected type-specifier [duplicate]

I want to decltype the return type by the param 'c.data()'. Could you give me some ideas.

my env: gcc4.8.5,c11.

template <class T>
auto data(const T& c)
  -> std::enable_if<std::is_convertible<decltype(c.data()), const char*>::type, const char*>::type {
  return c.data();
}

Aucun commentaire:

Enregistrer un commentaire