Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

incorrect argument to 'decltype'

template<class T>
std::vector<T> convert(int argument)
{
}

int main()
{
  decltype(&convert<int>);
  return 0;
}

The following gives this error for Visual Studio 2010:

error C3555: incorrect argument to 'decltype'

Why?

I'm tring to create a std::map where the key is an enum and the value is a function.

like image 452
Baz Avatar asked Sep 13 '12 10:09

Baz


1 Answers

VS2010 bug. That link also has a workaround:

template <typename T> T identity(T);
decltype(identity(&convert<int>));
like image 149
MSalters Avatar answered Nov 02 '22 19:11

MSalters