In the book C++ Design Patterns and Derivatives Pricing by Mark Joshi at p.75, he writes:
const T* const operator->() const
{
return DataPtr;
}
The first const
means that it returns a const object, and the last const
means that the operator is not allowed to modify the object on which it is called. But what about the second const
? What is its role?