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

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

以下は、Visual Studio 2010 のこのエラーを示しています。

error C3555: incorrect argument to 'decltype'

なんで?

キーが列挙型で値が関数である std::map を作成しようとしています。

4

1 に答える 1

9

VS2010 バグ。そのリンクには回避策もあります。

template <typename T> T identity(T);
decltype(identity(&convert<int>));
于 2012-09-13T10:48:39.980 に答える