pointer operator->()
{
return ptr_+buffer_position_;
}
const_pointer operator->() const
{
return ptr_+buffer_position_;
}
So the const overload returns a const pointer (yay) but the two functions do the same thing (boo) how does one avoid code duplication and the ensuing copypasta, while still maintaining const correctness?
(I'm looking at specifically C++98...though a C++11 answer would be pedagogic, as I suspect they did something to solve this problem).