我發現了幾個關於C++ 0x中的模板typedefs的問題,這些問題用using
關鍵字解決;然而,與GCC 4.6.1(運行g++ -std=c++0x
),我收到以下錯誤:template typedef C++ 0x
錯誤:「使用」之前預期不合格-ID
你能幫我找到我要去哪裏錯了嗎?我一直在試圖解決這個問題了幾個小時......
代碼:
#include <map>
template<typename INDEX, typename VALUE>
class GenericSparseVector
{
protected:
std::map<INDEX, VALUE> indices_to_values;
};
template <typename VALUE>
using StandardSparseVector = GenericSparseVector<int, VALUE>;
只是一個猜測,嘗試'模板使用StandardSparseVector = GenericSparseVector ;' –
2012-03-27 02:25:40
嗯...仍然沒有運氣。看起來我沒有足夠新的GCC版本。 – user 2012-03-27 02:31:23