typename std::iterator_traits<Iter>::value_type
This will work if your template is instantiated with Iter
as a pointer type.
By the way, typename
isn’t part of the type itself. It tells the compiler that value_type
really is a type. If it were the name of a function or a static data member, then that affects the syntax. The compiler doesn’t necessarily know what it is, since the specialization of iterator_traits
for Iter
might not be visible when the template is compiled.