I am trying to build a nested iterator template and relied on iterators having various traits like value_type. But as it turns out, not all STL types even return iterators with those traits. For instance:
#include <array>
#include <type_traits>
template <typename T>
using iterator_t = decltype(std::declval<T>().begin());
static_assert(std::is_same_v<iterator_t<std::array<int, 3>>, int*>);
This code compiles and shows that the actual type of the array iterator is int*. In that case, how can I still access traits such as value_type etc?
std::iterator_traits<iterator_t>. They are specialized for pointer types.