220 25981 <3687646a-55a2-46b3-a056-d2cdcb65c797@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Jakob Riedle <jakob.riedle@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Notification function for shared_from_this for
 when attachment happened?
Date: Sat, 21 May 2016 09:34:15 -0700 (PDT)
Lines: 67
Approved: news@gmane.org
Message-ID: <3687646a-55a2-46b3-a056-d2cdcb65c797@isocpp.org>
References: <CANu6V4XgJ7BynS4fCdXOLuAs17D2p_Q3Xh9WJhboYOd92i9Mdg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_349_980217733.1463848455285"
X-Trace: ger.gmane.org 1463848458 975 80.91.229.3 (21 May 2016 16:34:18 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 21 May 2016 16:34:18 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCX2XNFO6MPRBCE4QK5AKGQECTEGXGI@isocpp.org Sat May 21 18:34:18 2016
Return-path: <std-proposals+bncBCX2XNFO6MPRBCE4QK5AKGQECTEGXGI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f200.google.com ([209.85.220.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCX2XNFO6MPRBCE4QK5AKGQECTEGXGI@isocpp.org>)
	id 1b49r0-0005Rs-1I
	for gclcip-std-proposals@m.gmane.org; Sat, 21 May 2016 18:34:18 +0200
Original-Received: by mail-qk0-f200.google.com with SMTP id v128sf310674909qkh.1
        for <gclcip-std-proposals@m.gmane.org>; Sat, 21 May 2016 09:34:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=ImY+4tndI7d59MfD+wyKr4WPki/GyI1CfxIc/7ucKYY=;
        b=Dn+5pcv01oA/71udz1kCIrCjCy/Fg/vMRaJqQc6NAAwfgcbnqi/WcBPR7NZAIVkRKJ
         1qWj8TdgDYJpe98cXR42rMnBxCOzUri+PnhgwXwPRAW7r8aKk5jdHKIpYjXUns55TadN
         OIfWyHGJygQiL5vhRZhMSMLVj5w5GOrOxVs/J2BKz8PX0ObxpoUNnL3LQ1GWCUvzpPDm
         QM/9gJ0idGTpoQjQ7A2pG1t+s9VkUq3ofHT4DeEgbF/Ogcdk9xs1SAiYwmSeBXSnK4nM
         kL/ccmnhapQalEfBoGZ5n+bBj5nUMZC0NBSQGTe2s18c+I5NJOHySmCgLZd8+2X2Zd3j
         cYaw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=ImY+4tndI7d59MfD+wyKr4WPki/GyI1CfxIc/7ucKYY=;
        b=QQ3S7gIdJEy2ORUEKrB9CyN4btATTPGf7G4DLemAKs5SbuAeGgzE7E+G4y35Aynmlk
         UryrXTprvIL3ZEtAqR/3TdhikS5uT8pAPyQLM6B36K8yheOS75zCnX9RDMzZH4oGpRkp
         Y1zUXhI57ef9rE5ugXfc6dRsBUJ7HEYY9zO2whTZRvBHlH3ZpLDX188RCo9UtgXROsl5
         4Bp2m9B4INsZtchsHaVssUE4adVbPRqvxK/8drYjDThuKcpkqCNNdymug7qPFNbmfU8f
         K+KVwT5/RLgOYSsjN3oY2xuHS/ylEDec6/w7kHsLiH/r49TuVarBothS+NbIjm5eGMbz
         bONw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=ImY+4tndI7d59MfD+wyKr4WPki/GyI1CfxIc/7ucKYY=;
        b=BFvDr7fXZJ7HapeRh3G6Zh8PHqbGljxq+ZXN/jcwwe6lgkAt+PtcW5Oq6qNWLzrhEE
         0YRpIvhd3eBBq2rLFC/cp+t2V2pV2L21wSnhA2eU3ujc1U7Ygu4YWqEEJH24JE7qsqeU
         dI2jqbAC+BjXPbLIYw6+d/BkoaHkFuk36WsrivEYdxp74oOM3jjaxqaSTerK8UoetdA2
         1QqVBV0IGb1kYjmzFePGfzTIHrgZhraDBCPyD/s5mzXyhuSEiLhikPCUuvPwWOsMAOI0
         ESMo9xBay4iy7lDyWfSDanRHscy+F/LYUZOpiGSx1k6UlUwHZfg4wgtDv7ogGIs5W283
         zM6A==
X-Gm-Message-State: AOPr4FX6TBfE+na2wVsQtg17iWZJeK8wOZTGLH1ZwbSDawGJXsDPFUazyvR05KBuptHlrA==
X-Received: by 10.129.155.136 with SMTP id s130mr5870429ywg.24.1463848456978;
        Sat, 21 May 2016 09:34:16 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.50.202 with SMTP id j193ls453480ita.16.canary; Sat, 21 May
 2016 09:34:15 -0700 (PDT)
X-Received: by 10.36.84.85 with SMTP id t82mr131027ita.7.1463848455900;
        Sat, 21 May 2016 09:34:15 -0700 (PDT)
In-Reply-To: <CANu6V4XgJ7BynS4fCdXOLuAs17D2p_Q3Xh9WJhboYOd92i9Mdg@mail.gmail.com>
X-Original-Sender: jakob.riedle@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:25981
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/25981>

------=_Part_349_980217733.1463848455285
Content-Type: multipart/alternative; 
	boundary="----=_Part_350_1257815123.1463848455292"

------=_Part_350_1257815123.1463848455292
Content-Type: text/plain; charset=UTF-8

Since not being able to construct a shared_ptr pointing to *this in a 
constructor is a major downside in my opinion, I've written a *drop-in 
replacement* for shared_ptr and enable_shared_from_this:

https://sourceforge.net/projects/shared-from-this-ctor/

The only drawback is that it's not thread safe. For all single threaded 
purposes, it works really well. I would really like to see this 
functionality in some future version of C++, since this proof of concept 
does not require any more memory, nor is it significantly slower. By the 
way: The only reason for it not being thread-safe is, that I don't want to 
add any asm crack-pottery to my code.

Hope, I could help!

Cheers, Jakob

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3687646a-55a2-46b3-a056-d2cdcb65c797%40isocpp.org.

------=_Part_350_1257815123.1463848455292
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Since not being able to construct a shared_ptr pointi=
ng to *this in a constructor=C2=A0is a major downside in my opinion, I&#39;=
ve written a <b>drop-in replacement</b> for shared_ptr and enable_shared_fr=
om_this:</div><div><br></div><div>https://sourceforge.net/projects/shared-f=
rom-this-ctor/</div><div><br></div><div>The only drawback is that it&#39;s =
not thread safe. For all single threaded purposes, it works really well. I =
would really like to see this functionality in some future version of C++, =
since this proof of concept does not require any more memory, nor is it sig=
nificantly slower. By the way: The only reason for it not being thread-safe=
 is, that I don&#39;t want to add any asm crack-pottery to my code.</div><d=
iv><br></div><div>Hope, I could help!</div><div><br></div><div>Cheers, Jako=
b</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3687646a-55a2-46b3-a056-d2cdcb65c797%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3687646a-55a2-46b3-a056-d2cdcb65c797=
%40isocpp.org</a>.<br />

------=_Part_350_1257815123.1463848455292--

------=_Part_349_980217733.1463848455285--

.
