Boost logo

Boost :

From: Trevor Perrin (tperrin_at_[hidden])
Date: 2001-03-02 18:12:09


I meant:

int* A = new int;
const int* B = A;

shared_ptr<int> C = new int;
shared_ptr<const int> D =C;

Sorry.

-----Original Message-----
From: Trevor Perrin
Sent: Friday, March 02, 2001 3:10 PM
To: boost_at_[hidden]
Subject: converting shared_ptr<const T> to shared_ptr<T>

So I can convert a raw pointer A to a pointer-to-const B below. Is there a
way to tweak things so you can assign a shared_ptr C to a
shared_ptr-to-const D? Under VC6sp4 I get:

error C2440: 'initializing' : cannot convert from 'class
boost::shared_ptr<int>' to 'class boost::shared_ptr<int const >'
        No constructor could take the source type, or constructor overload
resolution was ambiguous

Which seems right.

int* A = new int;
const int* B = t;

shared_ptr<int> C = new int;
shared_ptr<const int> D =p1;


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