From 5638844864757684539
X-Google-Thread: f78e5,d860fade7481e4d8
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news3.google.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: Tue, 18 Apr 2006 16:00:01 -0500
Return-Path: <devnull@stump.algebra.com>
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on ak74.algebra.com
X-Spam-Level: ***
X-Spam-Status: No, score=3.4 required=5.0 tests=HEADER_SPAM,MISSING_HEADERS,
	TO_CC_NONE autolearn=disabled version=3.1.1
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)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@ucar.edu
From: "Alf P. Steinbach" <alfps@start.no>
Newsgroups: comp.std.c++
Subject: Re: tr1::shared_ptr and boost::shared_ptr
Message-ID: <4al25bFtp3o9U1@individual.net>
References: <1145386359.445242.255260@i39g2000cwa.googlegroups.com> <49-dnXlnpcXN2tjZnZ2dnUVZ_sKdnZ2d@giganews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Orig-X-Trace: individual.net +Cjx3L5GGxUj4wuQ+Dl23QuBgDnKVXZVaQlULxeB4kN6lgtQC/
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051201 Thunderbird/1.5 Mnenhy/0.7.3.0
X-Greylisting: NO DELAY (Relay+Sender autoqualified);
	processed by UCSD_GL-v2.1 on mailbox7.ucsd.edu;
	Tue, 18 April 2006 13:57:25 -0700 (PDT)
X-Spamscanner: mailbox7.ucsd.edu  (v1.6 Aug  4 2005 15:27:38, 0.0/5.0 3.0.4)
X-MailScanner: PASSED (v1.2.8 88487 k3IKvGJM019457 mailbox7.ucsd.edu)
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: Tue, 18 Apr 2006 15:59:40 CST
Lines: 41
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-mcwoP2eocV8NshiOvSdN2e22AdzNEbhGScnbaaaXkzE1blWtNA4RU2Ml9QGzzsSDaIoWNbYyM1Ees75!fK9aFVJgxG1iRMbeeaZVkwtGy8w56lXMrOVBcghWbvuQxHE6uZ33hYZ8glGoAopR0B/OvVWD7ccE!EVCiLwxbYyo=
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++:1598

* Pete Becker:
> Axter wrote:
>> What was the justification for the tr1 shared_ptr not to allow a custom
>> deleter like the boost::shared_ptr?
>>
> 
> There is none. It's part of the TR1 spec.

Oops, I didn't notice that.

Is there any hope of having a custom delete function added, as with 
boost::shared_ptr?

For example, boost::shared_ptr can be used with a class with protected 
or private destructor, without being a friend of that class, by passing 
it a deallocation function that does have access to the destructor.

For new code it's presumably no big deal to add friendship for a 
standard smart-pointer, but code that relies on the above technique with 
boost::smart_ptr won't work by simply replacing with std::shared_ptr 
(assuming that's what the TR1 shared_ptr will end up as).

In short, it will require workarounds for all code that now uses 
boost::shared_ptr and relies on the custom deleter, when such code is to 
be changed to use the standard shared_ptr.  And if the class in question 
can't be changed (adding friendship), then std::shared_ptr can't be 
used.  I think it would reflect badly on the standard library if one had 
to use boost::shared_ptr /in addition/ to std::shared_ptr.

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

---
[ 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.comeaucomputing.com/csc/faq.html                      ]



