Boost logo

Boost Users :

From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2005-07-26 10:36:29


Jack Nguyen wrote:

>Here is the compilable code:
>
>
<snip>

> VectorView(T* ptr, int size)
> {
> _size=size;
> _vp=boost::shared_array<T>(ptr);
> }
>
>
<snip>

>int main (void)
>{
> double a[]={1,2,3,4,5,6,7};
> VectorView<double>V(a,4);
> std::cout<<V;
> return 0;
>}
>
>Any workaround?
>
>
shared_array doesn't copy arrays (that's half the point of using it).
You really don't want to delete arrays with automatic storage, so don't
pass them to shared_array.

Ben.


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