Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: ANN: AutoNe...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 13 Topic 9589 of 9775
Post > Topic >>

Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)

by rpbg123@[EMAIL PROTECTED] (Roland Pibinger) May 12, 2008 at 09:27 AM

On Sun, 11 May 2008 20:13:18 CST, "Alf P. Steinbach" wrote:
>I just coded this up, and hopefully by mentioning it here I'll get 
>some useful feedback, like, bugs, shortcomings, improvements...
>
>http://code.google.com/p/alfps/source/browse/trunk/alfs/pointers/AutoNewPtr.hpp
>(http://preview.tinyurl.com/3puorr)

Disclaimer: Haven't looked into all the intricacy of the code in
detail.

>AutoNewPtr ("new" Berkeley open source license)
>
>   * Is not initialized with a raw pointer, but with constructor
>     arguments for the to-be referent: AutoNewPtr takes responsibility
>     for 'new'.

AFAICS, you need to sup****t const and non-const arguments.

>   * By doing that, it has the ability to add a notifier to the created
>     object, so that the smart pointer gets notified when referred
>     object self-destructs, if it does (e.g., a window or file closing,
>     or a non-correctable error).

Why? You are the owner/creator of the object. Self-destruction seems
to contradict the main point of the design.

>   * After referred object destroyed, pointer re****ts that it's void
>     and throws on access via ->.

Ok

>   * Also, the default constructor sets the pointer to void state.

Hmm, a semantic anomaly.

>   * Otherwise much like shared_ptr, except customization of deleter is
>     per type (via c++0x-like std::default_delete) rather than per
>     instance.

So it's a SharedNewPtr rather than a AutoNewPtr. I fail to see where
you can configure a deleter in 'template<typename T> class
AutoNewPtr'. Moreover, the main point of the design seems to be that
construction and destruction happen inside AutoNewPtr which
contradicts the customization of a deleter.


-- 
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch

      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 13 Posts in Topic:
ANN: AutoNewPtr (oh yes, yet another smartpointer)
"Alf P. Steinbach&qu  2008-05-11 09:42:27 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
=?ISO-8859-1?Q?Daniel_Kr=  2008-05-11 16:39:48 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
"Alf P. Steinbach&qu  2008-05-11 20:13:20 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
"Alf P. Steinbach&qu  2008-05-11 20:13:18 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
"Alf P. Steinbach&qu  2008-05-12 04:38:03 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
rpbg123@[EMAIL PROTECTED]  2008-05-12 09:27:13 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
Kai-Uwe Bux <jkherciue  2008-05-13 21:13:58 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
"Alf P. Steinbach&qu  2008-05-14 12:53:54 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
"Alf P. Steinbach&qu  2008-05-14 15:11:54 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
dizzy <dizzy@[EMAIL PR  2008-05-15 11:16:50 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
"Alf P. Steinbach&qu  2008-05-16 11:57:29 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
rpbg123@[EMAIL PROTECTED]  2008-05-16 17:29:51 
Re: ANN: AutoNewPtr (oh yes, yet another smartpointer)
"Alf P. Steinbach&qu  2008-05-18 02:43:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Jul 8 23:49:23 CDT 2008.