Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Smart pointers impractical a lot of the time (http://www.velocityreviews.com/forums/t267620-smart-pointers-impractical-a-lot-of-the-time.html)

Evan 06-23-2003 06:29 PM

Smart pointers impractical a lot of the time
 
Chandra Shekhar Kumar <chandra.kumar@oracle.com> wrote in message news:<3EF64860.3FCC6E7F@oracle.com>...
> donot use dude pointers ...use smart pointer instead


There's a problem with this approach. You have three options for using
smart pointers:

1) Use the standard library's auto_ptr,
2) Use one from another library, or
3) Write your own.

Option 3 is out because it requires intimate knowledge of the
different ways smart pointers can work and the uses it will be
subjected to. The poster is asking what the point of pointers is
(haha... *sees pun*) so I think it's safe to assume that neither of
these points are met.

Option 2 is better, but the lack of any standard implementation of
smart pointers (besides auto_ptr) means that generic books can't teach
it, libraries can't make good use of it, etc. Probably because of this
(and in spite of auto_ptr) I didn't know what smart pointers were
until a few days ago despite C++ programming for a couple years.

Option 1 is the most promising until you realize that the auto_ptr
doesn't behave appropriately in most circumstances. If the stardard
library had a painter with reference counting, then things wauld be in
much better shape.

Howard Hinnant 06-23-2003 06:42 PM

Re: Smart pointers impractical a lot of the time
 
In article <3f25c666.0306231029.60a55610@posting.google.com >, Evan
<eed132@psu.edu> wrote:

| 1) Use the standard library's auto_ptr,

| Option 1 is the most promising until you realize that the auto_ptr
| doesn't behave appropriately in most circumstances. If the stardard
| library had a painter with reference counting, then things wauld be in
| much better shape.

We're getting there...

http://anubis.dkuug.dk/jtc1/sc22/wg2...003/n1450.html

This was voted into a "Library Technical Report" just this Spring.
Vendors may ship it in namespace std::tr1 in the near future.

--
Howard Hinnant
Metrowerks


All times are GMT. The time now is 11:10 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57