簡體   English   中英

'decltype'的錯誤參數

[英]incorrect argument to 'decltype'

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,其中鍵是一個枚舉,值是一個函數。

VS2010的bug 該鏈接還有一個解決方法:

template <typename T> T identity(T);
decltype(identity(&convert<int>));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM