以下のようにmain関数でalias declaration的なのりでalias templateを使おうとしたらうまく行かなかった。
int main(int argc, char const* argv[]) {
template<typename T>
using MyType = T;
return 0;
}
でたコンパイルエラーは
a template declaration cannot appear at block scope
そこで規格(n3242)を読んでみたら14章のテンプレートのところに下記の記述があった。
A template-declaration can appear only as a namespace scope or class scope declaration.
ようするにテンプレートの宣言は名前空間のスコープあるいはクラスのスコープ内でしかできないというもの。
そしてAlias templatesは名前の通りテンプレート。
どおりでできないわけだ。
alias declarationとalias templateは似て非なるものだったんですね。