iterator_type
に関連付けられたイテレータタイプに設定するには、YYY、ZZZに何を書き込む必要がありますT
か?可能であれば、Visual Studio C ++ 2010で動作するはずです(ただし、一般的な標準ソリューションでも問題ありません)。
template<class T>
struct iterator_for {
typedef YYY<T>::ZZZ type;
}
したがって、私は欲しい:
iterator_for<double[3]>::type is double *
iterator_for<std::string>::type is std::string::iterator
iterator_for<char[12]>::type is char *
等
Wrapper<T>
反復可能なもの(つまり、コンテナー、文字列、または配列)を格納するテンプレートラッパークラスがあり、ラップされたオブジェクトを指す反復子を返す関数を定義したいと思います。そのためには、に対応するイテレータタイプについて話すことができる必要がありますT
。配列の場合、対応するイテレータはポインタになり、文字列の場合は、そのイテレータタイプとして定義されている文字列になります。