I’m wondering, if there is a way to check at compile time whether a type T of some iterator type is a const_iterator, or not. Is there some difference in the types that iterators define (value_type, pointer, …) between iterators and const iterators?
I would like to achieve something like this:
typedef std::vector<int> T;
is_const_iterator<T::iterator>::value // is false
is_const_iterator<T::const_iterator>::value // is true
C++03 Solution:
As none of the answer seems correct, here is my attempt which is working with GCC:
Example:
Output:
Online Demo : http://ideone.com/TFYcW