
On Mon, Jul 8, 2013 at 3:28 PM, Jonathan Wakely <jwakely.boost@kayari.org> wrote:
On 8 July 2013 12:20, Andrey Semashev wrote:
On Mon, Jul 8, 2013 at 3:04 PM, Sid Sacek <ssacek@securewatch24.com> wrote:
What I mean is, operator->() does not exist. How can it be a pointer when it is not possible to use pointer notation?
In that case I'd consider this a bug.
It's consistent with the interface of std::unique_ptr<T[]>.
You can use p.get()->x instead of p->x if you really want to use that notation to access the first element only, but how often do you really want to access the first element of an array, and p[0] isn't just as natural?
I don't see anything wrong with accessing the array element with operator->. This may be limited to the first element only in case of unique_ptr, but shared_ptr supports pointer aliasing, so it can refer to any element within the array. But even in case of unique_ptr I would still provide operator-> for sake of consistency.