220 4572 <51A0ADAE.5030908@wanadoo.fr> article
Path: news.gmane.org!not-for-mail
From: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: N3558 :A standardized representation of
 Asynchronous operations
Date: Sat, 25 May 2013 14:25:18 +0200
Lines: 141
Approved: news@gmane.org
Message-ID: <51A0ADAE.5030908@wanadoo.fr>
References: <519F9E48.7050700@wanadoo.fr> <c959abc7-55a0-4a6a-9b20-9752cbe63af0@isocpp.org> <519FB94F.7090703@wanadoo.fr> <CAGg_6+N60LQLUXvkzY_4-8=-OuBQ-s+n4GttmNTKm7VMc8vfuA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------030901000208050905050609"
X-Trace: ger.gmane.org 1369484724 4503 80.91.229.3 (25 May 2013 12:25:24 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 25 May 2013 12:25:24 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDH67CONY4PBBMO3QKGQKGQEFMGPDEI@isocpp.org Sat May 25 14:25:23 2013
Return-path: <std-proposals+bncBDH67CONY4PBBMO3QKGQKGQEFMGPDEI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-bk0-f72.google.com ([209.85.214.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDH67CONY4PBBMO3QKGQKGQEFMGPDEI@isocpp.org>)
	id 1UgDXH-0001hd-1O
	for gclcip-std-proposals@m.gmane.org; Sat, 25 May 2013 14:25:23 +0200
Original-Received: by mail-bk0-f72.google.com with SMTP id jk13sf1900366bkc.11
        for <gclcip-std-proposals@m.gmane.org>; Sat, 25 May 2013 05:25:22 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=x-beenthere:message-id:date:from:user-agent:mime-version:to:subject
         :references:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=MUD5XBWpZ5rt0MAkS0LoVMd6HRvEDrqxGNHmY9p8h84=;
        b=JuQTdU8ug3vQKtcfCJL4G1TIHRsKgHNulXSzu03ygfg+0FDmXJbBbrPWa6rDkYnrxa
         sUNay6zQixBDq5rg+NKhWN8ZP8VdECdewjqvMIDfALTJCS+nraZEPIytqoRHjf8ZgINM
         7T7r6VM0R07TaC+q6fewjO8DqTRGzKU4RzLT5MJHabH3rPpV/RfW/Pgt3QfZsmPzISB2
         kXJ7Q6hlxbXDf5WXmW+7lh+uiPpwN7d9KpxPoAJHGhz3WY7WzxeiWO5eeiYZyZlql7jf
         dgRqDHN62mibyB1Gxj1zPa0TTe1JumCnErlgPgT73rBA+v4cg1rW69HxBWw37npWxsR5
         ebTQ==
X-Received: by 10.180.76.115 with SMTP id j19mr1107147wiw.2.1369484722177;
        Sat, 25 May 2013 05:25:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.76.71 with SMTP id i7ls417327wiw.34.gmail; Sat, 25 May
 2013 05:25:21 -0700 (PDT)
X-Received: by 10.14.47.136 with SMTP id t8mr3438424eeb.47.1369484721264;
        Sat, 25 May 2013 05:25:21 -0700 (PDT)
Original-Received: from smtp.smtpout.orange.fr (smtp06.smtpout.orange.fr. [80.12.242.128])
        by mx.google.com with ESMTP id x2si3866077eef.136.2013.05.25.05.25.21
        for <std-proposals@isocpp.org>;
        Sat, 25 May 2013 05:25:21 -0700 (PDT)
Received-SPF: neutral (google.com: 80.12.242.128 is neither permitted nor denied by best guess record for domain of vicente.botet@wanadoo.fr) client-ip=80.12.242.128;
Original-Received: from iMac-de-Vicente-Botet-Escriba.local ([2.13.6.91])
	by mwinf5d41 with ME
	id gCRJ1l00E1xq0tN03CRLyo; Sat, 25 May 2013 14:25:20 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
In-Reply-To: <CAGg_6+N60LQLUXvkzY_4-8=-OuBQ-s+n4GttmNTKm7VMc8vfuA@mail.gmail.com>
X-Original-Sender: vicente.botet@wanadoo.fr
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 80.12.242.128 is neither permitted nor denied by best guess
 record for domain of vicente.botet@wanadoo.fr) smtp.mail=vicente.botet@wanadoo.fr
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?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:4572
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4572>

This is a multi-part message in MIME format.
--------------030901000208050905050609
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 24/05/13 22:24, Nevin Liber a =E9crit :
> On 24 May 2013 14:02, Vicente J. Botet Escriba=20
> <vicente.botet@wanadoo.fr <mailto:vicente.botet@wanadoo.fr>> wrote:
>
>
>     Returning future<pair<size_t, vector<future<R>>>> would provide
>     efficiency and safety.
>
>
> If you are going to go this route, please don't use pair.  It is much=20
> better to have field names that mean something.

I agree that using accessors would be more readable, hide the=20
representation and in addition it could provide a value function that=20
would retrieve the first value set. The quiz would be to find a name for=20
the class providing these accessors ;-)  Any suggestion is welcome.

template <typename R>
class ???
{
public:
   vector<future<R> vector() && noexcept;
   R value() &;
};

auto f =3D when_any(f1, f2);
....
int i =3D f.get().value(); // efficiency
vector<future<R> v =3D f.get().vector(); // safety

The following is safe as the futures are transfered to the new variable
   auto f =3D when_any(f1, f2).to_vector();

But should the following compile
   int i =3D when_any(f1, f2).value();

With the following declaration the preceding statement must fail at=20
compile time, isn't it?
   R value() &;

Vicente

--=20

---=20
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 e=
mail 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-proposa=
ls/?hl=3Den.



--------------030901000208050905050609
Content-Type: text/html; charset=ISO-8859-1

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Le 24/05/13 22:24, Nevin Liber a
      &eacute;crit&nbsp;:<br>
    </div>
    <blockquote
cite="mid:CAGg_6+N60LQLUXvkzY_4-8=-OuBQ-s+n4GttmNTKm7VMc8vfuA@mail.gmail.com"
      type="cite">On 24 May 2013 14:02, Vicente J. Botet Escriba <span
        dir="ltr">&lt;<a moz-do-not-send="true"
          href="mailto:vicente.botet@wanadoo.fr" target="_blank">vicente.botet@wanadoo.fr</a>&gt;</span>
      wrote:<br>
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"><br>
            Returning future&lt;pair&lt;size_t,
            vector&lt;future&lt;R&gt;&gt;&gt;&gt; would provide
            efficiency and safety.<span class="HOEnZb"></span><br>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      If you are going to go this route, please don't use pair.&nbsp; It is
      much better to have field names that mean something.<br>
    </blockquote>
    <br>
    I agree that using accessors would be more readable, hide the
    representation and in addition it could provide a value function
    that would retrieve the first value set. The quiz would be to find a
    name for the class providing these accessors ;-)&nbsp; Any suggestion is
    welcome.<br>
    <br>
    template &lt;typename R&gt;<br>
    class ???<br>
    {<br>
    public:<br>
    &nbsp; vector&lt;future&lt;R&gt; vector() &amp;&amp; noexcept;<br>
    &nbsp; R value() &amp;;<br>
    };<br>
    <br>
    auto f = when_any(f1, f2);<br>
    ...<br>
    int i = f.get().value(); // efficiency<br>
    vector&lt;future&lt;R&gt; v = f.get().vector(); // safety<br>
    <br>
    The following is safe as the futures are transfered to the new
    variable<br>
    &nbsp; auto f = when_any(f1, f2).to_vector();<br>
    <br>
    But should the following compile<br>
    &nbsp; int i = when_any(f1, f2).value();<br>
    <br>
    With the following declaration the preceding statement must fail at
    compile time, isn't it?<br>
    &nbsp; R value() &amp;;<br>
    <br>
    Vicente<br>
  </body>
</html>

<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 email 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="http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en">http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en</a>.<br />
&nbsp;<br />
&nbsp;<br />

--------------030901000208050905050609--

.
