我有以下源代码,用 MinGW 编译。但是当我尝试构建时,我遇到了编译类型错误:
main.cpp:11: error: expected type-specifier
using Iter = MyMap::iterator;
^
main.cpp:12: error: expected type-specifier
using CIter = MyMap::const_iterator;
^
GCC 期望在MyMap
. 但它期望哪个说明符?
#include <ctime>
#include <map>
template< typename T >
class MyClass
{
private:
class Inner {};
using MyMap = std::map< time_t, Inner >;
using Iter = MyMap::iterator;
using CIter = MyMap::const_iterator;
};
int main()
{
return 0;
}