あるstructのメンバであるtemplate structをtemplate argumentとして受け取ってその中身をtypedefする、というときの書き方が(もう少し普通な状況でも出てくると思うが調べていない)、この18行目の文法がキモい2017だったので置いておく。
この書き方は寡聞にしてしらなかった
#include <iostream> #include <array> struct X { template<typename T> struct fixed_array; }; template<> struct X::fixed_array<double> { typedef std::array<double, 4> type; }; template<typename T, typename F> struct Y { typedef typename F::template fixed_array<T>::type type;//これ type container; }; int main() { typedef Y<double, X>::type type; type p{{1.,2.,3.,4.}}; for(auto&& item : p) std::cout << item << std::endl; return 0; }
しかし何度か書いてから見直すと自然に見えてくるのだから不思議だ。