为什么我不能在函数内声明模板化类型别名?
#include <vector>
int main(){
//type alias deceleration:
template <typename T>
using type = std::vector<T>;
//type instantiation:
type<int> t;
}
错误:模板声明不能出现在块范围内
为什么我们被迫将这些声明放在块范围之外?
#include <vector>
//type alias deceleration:
template <typename T>
using type = std::vector<T>;
int main(){
//type instantiation:
type<int> t;
}