From -9059399937530508805
X-Google-Thread: f78e5,6dda3f736a89f6d8
X-Google-NewGroupId: yes
X-Google-Attributes: gid7894ca11fe,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news1.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 26 Aug 2010 00:00:46 -0500
Return-Path: <cppmods@ruralroute.cs.rpi.edu>
To: (Usenet)
From: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@googlemail.com>
Newsgroups: comp.std.c++
Subject: Re: shared_from_this() from constructor
Organization: http://groups.google.com
Sender: cppmods@cs.rpi.edu
Approved: james.dennett@gmail.com
Message-ID: <4bb0f4c3-5ef7-410f-be68-39cc0d61ca21@z28g2000yqh.googlegroups.com>
References: <de2bf2a0-c5b7-4ba2-a4e2-85842f0a0c4b@q22g2000yqm.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
X-Original-Date: Wed, 25 Aug 2010 14:58:08 -0700 (PDT)
X-Submission-Address: std-c++@netlab.cs.rpi.edu
Date: Wed, 25 Aug 2010 23:57:18 CST
Lines: 35
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-QgAvLoU/1hv2VDo2CYmSCvTtnDLeoVJMaLrNggmZHB1MpQmPaD9Au4dRzSco2/DSAX64nW3nJ8NubSB!k6tLewKqzza6guhEkGrQVYqktE4AXZHvlTEI1Ud1iwspmPPXr2GwJd1WKkE2pe5JyxyljDhuf+Cu!6zxtiUNPMYVu1mCvfSV4c1vKIvE=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
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.40
Xref: g2news1.google.com comp.std.c++:2904

On 26 Aug., 00:49, Florian Goujeon <florian.gouj...@42ndart.org>
wrote:
> The current GCC's implementation doesn't allow to call
> shared_from_this() from the class' constructor, just like the original
> Boost's implementation.
> Is this a standard-compliant behavior? The current draft doesn't talk
> about this.
> I hope it's not. This is really annoying...

A pre-condition of the call of

shared_ptr<T> shared_from_this();
shared_ptr<T const> shared_from_this() const;

are:

"*this shall be a subobject of an object t of type T. There
shall be at least one shared_ptr instance p that owns &t."

Can you satisfy this in your constructor?

If not: What do you want to realize?

HTH & Greetings from Bremen,

Daniel Kr�gler



--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



