Boost logo

Boost Users :

Subject: Re: [Boost-users] question about boost pointer
From: Ted Byers (r.ted.byers_at_[hidden])
Date: 2012-06-08 11:49:47


> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of young
> Sent: June-08-12 11:33 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] question about boost pointer
>
> Can I define:
>
> int a[100];
> boost::shared_ptr<int> p(a);
>
> and get next int by using p?
>
No. boost::shared_ptr is for objects created using operator new (and thus
deleted using operator delete) while boost::shared_array is for objects
created using operator new[] (and thus deleted using operator delete[]).

use boost::shared_array instead, or for more flexibility, use std:;vector.

HTH

Ted


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