templateの中にtemplateを書く事が可能です。
その場合のメリットは geho_<std::vector> クラステンプレートをそのままテンプレートに渡せます。
namespace my_
{
template <class T1, typename T2> struct hoge_{};
template<
template<typename, typename> class T,
typename T1, typename T2>
struct geho_
{
T<T1, T2> t_;
};
};
geho_ クラスにhoge_ を入れてますが、geho_内でTテンプレートに型指定しています。 なので下記の様に渡す事ができます。
my_::geho_<my_::hoge_, TObject, TObject> geho_hoge_;
hoge_をvectorに置き換えますとvectorは< class T, class Allocator = allocator<T>>なので
my_::geho_<std::vector, char, std::allocator<char>> geho_vector;
上記の様に書く事ができます。
my::geho_<std::vector, char, std::allocator<char>> これではchar 2回も入れるの嫌なので
template<
template<typename,typename> class T,
typename T1, template<typename> class T2>
struct gehox_
{
T<T1, T2<T1> > t_;
};
こうしますと
my_::gehox_<std::vector, char, std::allocator> geho_vector;
スマートになりました。
