What do I have to write for YYY, ZZZ in order to set iterator_type to the iterator type associated with T ? It should work in Visual Studio C++ 2010, if possible (but general standard solution is ok as well).
template<class T>
struct iterator_for {
typedef YYY<T>::ZZZ type;
}
Hence I want:
iterator_for<double[3]>::type is double *
iterator_for<std::string>::type is std::string::iterator
iterator_for<char[12]>::type is char *
etc.
I have a templated wrapper class Wrapper<T> storing something iterable (i.e. a container or string or an array) and I want to define a function returning an iterator pointing into the wrapped object. For that purpose, I need to be able to speak about the iterator type corresponding to T. For an array, the corresponding iterator would be a pointer, and for a string that is whatever string defines to be its iterator type.
If you just want to separate containers from pointers, you can try this