最近在玩c++的模板元,但是有一次编译器报了一个令人困惑的错:
版本: g++ (MinGW.org GCC Build-2) 9.2.0, 标准为c++17.
test.cpp:23:36: error: expected ';' before '<' token
23 | using result = typename List::Push<T>::result;
| ^
| ;
故事的起因是这样的,我在写一个TypeList
, 里面有一个元函数Push<typename T>
,用来给TypeList
尾端添加一个类型.