Boost logo

Boost :

Subject: [boost] shared_ptr<>: why no operator[] ?
From: dgwsoft (gareth_at_[hidden])
Date: 2011-07-26 18:39:37


boost::shared_ptr<int> p(new int(42));

To access elements of the array I can do:

p.get()[10] = 7;

But wouldn't it be nicer to do:

p[10] = 7; // ?

So: why is no T& operator[](int) defined for shared_ptr ? I'm just
interested in the design reasons for this.

cheers

Gareth

--
View this message in context: http://boost.2283326.n4.nabble.com/shared-ptr-why-no-operator-tp3697208p3697208.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk