Why is operator-> implemented by operator * in STL STL library?
I read the source code std::deque
, I found the following implementations for _deque_iterator::operator->
and_deque_iterator::operator*
reference operator* const() { return *cur; }
pointer operator-> const(){ return &(operator*()); }
So my question is, why not just return a pointer cur
? Like this:
pointer operator-> const(){ return cur; }
+3
source to share