From -620008485345348751
X-Google-Thread: f78e5,52dd3e1082ac085e,start
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 01 Sep 2005 23:20:14 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Delivered-To: std-c++@ucar.edu
From: "l.j.persson@gmail.com" <l.j.persson@gmail.com>
Newsgroups: comp.std.c++
Subject: unique_ptr
Organization: http://groups.google.com
Message-ID: <1125603471.570361.32720@o13g2000cwo.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050730 Firefox/1.0.6,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: o13g2000cwo.googlegroups.com; posting-host=83.226.139.173;
   posting-account=P4K6Xg0AAADBvPeeRZDWKWPfS0sdochz
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Date: Thu,  1 Sep 2005 23:11:56 CST
Lines: 30
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-GbVdGsQ6E2I9Fw5QNeHiQpaJN+cbpUHf4WblpAlAj3MJAOwrJOLHWh7hRtk0iOILCUcy76BYLHeHDlr!2sIO/Cv3R9OrbMNrD2Ah2XDyoiw0Frr0H9Hutp7P3sBAGyat6w7lX0IO6HnQkIWSgs3QGbP4UYLy!79LnDycQ/l65cqKWbpgzNV8/aRxKx1zI4s+beDoOFw==
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Xref: g2news1.google.com comp.std.c++:1997

Hello,
I was just reading the excellent proposal on unique_ptr
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1856.html).
But I have a question on the constructor: why doesn't it take a T*&&
parameter?

explicit unique_ptr(T*&& p);

If I understand rvalues correctly that would mean:

unique_ptr<int> ui(new int); // Ok
int* pi = new int;
unique_ptr<int> ui(pi); // Not Ok

In current implementation we have

int* pi = new int;
unique_ptr<int> ui1(pi); // Ok
unique_ptr<int> ui2(pi); // Ok, but no good

same applies to operator=() and reset().

  / Jonas

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]



