The advice I've always heard is that inheritance from anything in the standard is frowned upon. I should have a has-a not is-a relationship to it.
I think that is not true with respect to iterators, right? We must inherit from iterator
in our boilerplate right?
std::iterator
but doing so is silly as you have to type all the boilerplate then.iterator_traits
takes advantage of the fact that iterators have the types in them (the default implementation). But the alternative way is to specialize iterator_traits for your type. Its 6 of one half a dozen of the other. The STL accesses the type information about your iterator via the iterator_traits (I believe) not an expert on this part. But the real point is SFINAE means you don't need to specify the types if you are not using them.