Boost logo

Boost Users :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2007-12-06 17:05:30


On Dec 6, 2007 2:22 PM, Damien Hocking <damien_at_[hidden]> wrote:
> [snip]
>
> testPtr->*dptr = 5.7456;
>
> On VS2005, I get an error on the ->*:
>
> error C2296: '->*' : illegal, left operand has type 'boost::shared_ptr<T>'
>
> This line is fine:
>
> (*testPtr).*dptr = 5.7456;
>
> Can anyone tell me why the compiler isn't converting
> boost::shared_ptr<TestObject> to a TestObject* through
> shared_ptr::operator-> ?

shared_ptr overloads the -> operator but not the ->* operator (they
are two separate operators). In an expression like testPtr->*dptr =
5.7456; it's looking for the ->* operator, not ->.

HTH,

Stjepan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net