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 ite
This is a bit hacky because you have to pass T itself but it works (template specialization, g++ 4.4.5):
template
struct is_const_iterator {
enum {
value = false
};
};
template
struct is_const_iterator {
enum {
value = true
};
};
Use like this:
typedef std::vector T;
is_const_iterator::value //is false
is_const_iterator::value //is true