220 6065 <cb4bef4a-a995-40a5-a077-630553fe6ec3@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: the.ultimate.koala@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Allowing constructors to apply
 initializations to itself?
Date: Sun, 1 Sep 2013 03:52:51 -0700 (PDT)
Lines: 175
Approved: news@gmane.org
Message-ID: <cb4bef4a-a995-40a5-a077-630553fe6ec3@isocpp.org>
References: <ba9b0e99-abcd-4cf8-845b-24d944c8723e@isocpp.org>
 <6ad60824-1c86-4815-acc9-1212a369379d@isocpp.org>
 <CANPOWsc5kxU6+vtObFK9pcixE8FCVQ6qTk5WFNRcRzuajHrvJg@mail.gmail.com>
 <CANu6V4WUYom+n1SaJ564aD9+QfijVts+DC+63c0XD9+tYZ3z_A@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_2423_18151591.1378032771277"
X-Trace: ger.gmane.org 1378032771 32079 80.91.229.3 (1 Sep 2013 10:52:51 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 1 Sep 2013 10:52:51 +0000 (UTC)
Cc: schaub.johannes@googlemail.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDIODEPKWANBBA5ZRSIQKGQEEQ4DWWY@isocpp.org Sun Sep 01 12:52:54 2013
Return-path: <std-proposals+bncBDIODEPKWANBBA5ZRSIQKGQEEQ4DWWY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ve0-f197.google.com ([209.85.128.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDIODEPKWANBBA5ZRSIQKGQEEQ4DWWY@isocpp.org>)
	id 1VG5H3-0004jU-Ic
	for gclcip-std-proposals@m.gmane.org; Sun, 01 Sep 2013 12:52:53 +0200
Original-Received: by mail-ve0-f197.google.com with SMTP id ox1sf4189134veb.4
        for <gclcip-std-proposals@m.gmane.org>; Sun, 01 Sep 2013 03:52:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=T9KetEQ64kSTdsQAK+kKhnoXtrBtC2MQFxiqEg7Fyg4=;
        b=jklOIKlxPIciadyz2C4m4sWNHL5POTTP0Jt77lnFnxqjxNQMIEy2j/mzzqGNB6VCWd
         8/RO4/Vl8YvtgBSkhnGHgGB24C5qPz9SoL6LyNIOvbv/P0841ARPhfu3E9xMGe06PZ4I
         q9lr192OTfitS39sB1YFqBqwDNtntiPf4Y/f8ZHFsRirDaCC5pLJjP5W8p+QQ77U8t1f
         63EecACCZ7g/7GtekbnjPxOjtxyG8TomX9H6fRrAFyAWpl+mCrhCyR8ISxANOMGyIkHG
         QKZ36SYYm0EZw6KA4rQosz+QIWPEw54JHeBwxfDq2AiWnpN47V5TXDkVs/+2kN/1fibA
         dCdg==
X-Received: by 10.236.109.134 with SMTP id s6mr6194049yhg.32.1378032772226;
        Sun, 01 Sep 2013 03:52:52 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.30.35 with SMTP id p3ls1907347qeh.97.gmail; Sun, 01 Sep
 2013 03:52:51 -0700 (PDT)
X-Received: by 10.49.98.162 with SMTP id ej2mr8113qeb.10.1378032771652;
        Sun, 01 Sep 2013 03:52:51 -0700 (PDT)
In-Reply-To: <CANu6V4WUYom+n1SaJ564aD9+QfijVts+DC+63c0XD9+tYZ3z_A@mail.gmail.com>
X-Original-Sender: theultimatekoala@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:6065
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/6065>

------=_Part_2423_18151591.1378032771277
Content-Type: text/plain; charset=ISO-8859-1

Can't you do this by delegating to a private constructor ?

    struct HelperStruct { 
      A(Manager *m) 
        : A{m->factory(), m->layouter()} { 
        m->prepare(); 
      } 
 
      shared_ptr<Factory> factory; 
      shared_ptr<Factory> layouter:
    private:
      A(const shared_ptr<Factory>& factory_,  const shared_ptr<Factory>& 
layouter_) 
        : factory{factory_}, layouter{layouter_} {
      } 
    }



On Monday, June 24, 2013 10:19:44 AM UTC+2, Johannes Schaub wrote:
>
> 2013/6/24 Arthur Tchaikovsky <atch...@gmail.com <javascript:>>: 
> > Hi, perhaps instead of static the default keyword would be more 
> > appropriate as it will suggest that object will get initialized to its 
> > default values? 
> > 
>
> Not necessarily 
>
>     struct HelperStruct { 
>       A(Manager *m) 
>         :static A{m->factory(), m->layouter()} { 
>         m->prepare(); 
>       } 
>
>       shared_ptr<Factory> factory; 
>       shared_ptr<Factory> layouter; 
>     }; 
>

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_2423_18151591.1378032771277
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Can't you do this by delegating to a private constructor ?=
<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250,=
 250); border-color: rgb(187, 187, 187); border-style: solid; border-width:=
 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"sub=
prettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify">&nbs=
p; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #606;" class=3D"styled-by-prettify">HelperStruct<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> <br>&nbsp; &nbsp; &nbsp; A<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">Manager</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">*</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">m</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> <br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> A</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">m</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">-&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>factory</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()=
,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> m</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">layouter</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">()}</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> <br>&nbsp; &nbsp; &nbsp; &nbsp; m</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">prepare</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> <br>&nbsp; &nbsp; &nbsp; </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> <br>&nbsp;<br>&nbsp; &nbsp; &n=
bsp; shared_ptr</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">F=
actory</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> factory</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> <br>&nbsp; &nbsp; &n=
bsp; shared_ptr</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">F=
actory</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> layouter<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">private</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp;=
 A</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(const <=
/span><code class=3D"prettyprint"><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">shared_ptr</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">Factory</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">&amp; factory</span></code><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">_,&nbsp; </span><code class=3D"prettyprint"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">const </span><code class=3D"prettypr=
int"><span style=3D"color: #000;" class=3D"styled-by-prettify">shared_ptr</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Factory</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">&amp; layouter</span></code=
><span style=3D"color: #000;" class=3D"styled-by-prettify"></span></code><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">_)</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> <br>&nbsp; &nbsp; &nbsp; &nbsp; </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> factory{factory_}, la=
youter{layouter_}</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; =
&nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br>=
&nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
/span></div></code></div><br><br><br>On Monday, June 24, 2013 10:19:44 AM U=
TC+2, Johannes Schaub wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">20=
13/6/24 Arthur Tchaikovsky &lt;<a href=3D"javascript:" target=3D"_blank" gd=
f-obfuscated-mailto=3D"qm8lqDpcMxwJ">atch...@gmail.com</a>&gt;:
<br>&gt; Hi, perhaps instead of static the default keyword would be more
<br>&gt; appropriate as it will suggest that object will get initialized to=
 its
<br>&gt; default values?
<br>&gt;
<br>
<br>Not necessarily
<br>
<br>&nbsp; &nbsp; struct HelperStruct {
<br>&nbsp; &nbsp; &nbsp; A(Manager *m)
<br>&nbsp; &nbsp; &nbsp; &nbsp; :static A{m-&gt;factory(), m-&gt;layouter()=
} {
<br>&nbsp; &nbsp; &nbsp; &nbsp; m-&gt;prepare();
<br>&nbsp; &nbsp; &nbsp; }
<br>
<br>&nbsp; &nbsp; &nbsp; shared_ptr&lt;Factory&gt; factory;
<br>&nbsp; &nbsp; &nbsp; shared_ptr&lt;Factory&gt; layouter;
<br>&nbsp; &nbsp; };
<br></blockquote></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_2423_18151591.1378032771277--

.
