Topic: array version of auto_ptr?


Author: "Brown, Jeff" <Jeff_Brown@Intuit.com>
Date: Thu, 21 Dec 2000 17:55:13 GMT
Raw View
It seems odd to me that the C++ standard library provides auto_ptr,
which can
own a single object allocated by operator new, but does not provide a
similar
class for owning an array of objects allocated with operator new[].

Am I missing something?  Is there some technical reason that it could
not be
done?  Was it left out for a reason?

Jeff Brown

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: "Stephen Howe" <SPAMGUARDstephen.howe@dial.pipex.co.uk>
Date: Thu, 21 Dec 2000 18:24:52 GMT
Raw View
Brown, Jeff <Jeff_Brown@Intuit.com> wrote in message
news:3A4140D9.6EE75268@Intuit.com...
> It seems odd to me that the C++ standard library provides auto_ptr,
> which can
> own a single object allocated by operator new, but does not provide a
> similar
> class for owning an array of objects allocated with operator new[].
>
> Am I missing something?  Is there some technical reason that it could
> not be
> done?  Was it left out for a reason?

Use vector

Stephen Howe


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Thu, 21 Dec 2000 20:24:46 GMT
Raw View
In article <3A4140D9.6EE75268@Intuit.com>, Brown, Jeff
<Jeff_Brown@Intuit.com> writes
>It seems odd to me that the C++ standard library provides auto_ptr,
>which can
>own a single object allocated by operator new, but does not provide a
>similar
>class for owning an array of objects allocated with operator new[].
>
>Am I missing something?  Is there some technical reason that it could
>not be
>done?  Was it left out for a reason?

Probably because vector provides almost all the required functionality
without some of the deadly dangers :)


Francis Glassborow      Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]