|
Boost : |
From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-04-06 10:39:22
Because this block has undefined behavior
{
auto_ptr<T> p = new T[n];
}
because it calls
delete p;
and not
delete[] p;
like it should, so we want to provide
auto_array_ptr<T> p = new T[n];
and perhaps
auto_ptr<T[]> p = new T[n];
instead.
----- Original Message -----
From: Amir Husain
To: boost_at_[hidden]
Sent: Friday, April 06, 2001 7:04 AM
Subject: [boost] About auto_array_ptr
Sorry
Must look like a kid question the thing i wanna ask is why do we use auto_array_ptr rather then the normal pointer wat benefits are
there in using it??
Why a auto_ary_ptr noa a normal ptr?
thanks
amir
>From: "David Abrahams"
>Reply-To: boost_at_[hidden]
>To:
>Subject: Re: [boost] Re: auto_array_ptr
>Date: Fri, 6 Apr 2001 08:42:55 -0400
>MIME-Version: 1.0
>Received: from [208.50.99.198] by hotmail.com (3.2) with ESMTP id MHotMailBC97046F005540043163D03263C68CF9139; Fri Apr 06 05:51:08
2001
>Received: from [10.1.4.52] by hm.egroups.com with NNFMP; 06 Apr 2001 12:45:21 -0000
>Received: (EGP: mail-7_1_1); 6 Apr 2001 12:45:20 -0000
>Received: (qmail 5897 invoked from network); 6 Apr 2001 12:44:49 -0000
>Received: from unknown (10.1.10.26) by m8.onelist.org with QMQP; 6 Apr 2001 12:44:49 -0000
>Received: from unknown (HELO hwd.net) (63.201.110.219) by mta1 with SMTP; 6 Apr 2001 12:44:49 -0000
>Received: from davida [205.181.17.12] by hwd.net (SMTPD32-5.01) id ABB03F40256; Fri, 06 Apr 2001 04:50:56 PST
>From sentto-1234907-8052-986561121-amirhusain Fri Apr 06 05:53:00 2001
>X-eGroups-Return: sentto-1234907-8052-986561121-amirhusain=hotmail.com_at_[hidden]
>X-Sender: abrahams_at_[hidden]
>X-Apparently-To: boost_at_[hidden]
>Message-ID: <019501c0be97$1aaf9e70$6701a8c0_at_[hidden]>
>References: <009d01c0be8f$a79478e0$160524d4_at_pdimov> <017601c0be92$74f59c90$6701a8c0_at_[hidden]>
<00bf01c0be95$331395e0$160524d4_at_pdimov>
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Mailer: Microsoft Outlook Express 5.50.4133.2400
>X-Mimeole: Produced By Microsoft MimeOLE V5.50.4133.2400
>X-eGroups-From: "David Abrahams"
>Mailing-List: list boost_at_[hidden]; contact boost-owner_at_[hidden]
>Delivered-To: mailing list boost_at_[hidden]
>Precedence: bulk
>List-Unsubscribe:
>
>
>----- Original Message -----
>From: "Peter Dimov"
>
>
> > The caveat about temporary smart pointer objects still applies. My rule is
> > "never create an unnamed temporary smart pointer." The non-const reference
> > idiom tries to enforce this rule... although I have another reason for
> > preferring pass by non-const reference:
> >
> > void f(T arg);
> >
> > T t;
> >
> > f(t);
> >
> > // now t is unchanged, right?
>
>Wrong, of course. Usually, the declaration of f isn't visible near the call,
>so you can't assume much about what's changed. But this case could be seen
>as an argument for using the unnamed temporary... then there's no object
>hanging around with a confusing value.
>
>-Dave
>
>
>To unsubscribe, send email to:
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk