220 26366 <CAGNvRgCYLywvtFSO65-NKpeycpT4cPnw0SjvQPhE_DRL98UO7g@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?UTF-8?Q?Daniel_Kr=C3=BCgler?= <daniel.kruegler@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Swapping with volatile lvalues
Date: Tue, 21 Jun 2016 12:18:05 +0200
Lines: 32
Approved: news@gmane.org
Message-ID: <CAGNvRgCYLywvtFSO65-NKpeycpT4cPnw0SjvQPhE_DRL98UO7g@mail.gmail.com>
References: <81998cb5-722e-49a1-be98-7ca1e219b72a@isocpp.org>
 <CAGNvRgB9K2W=AL5y3b7PbVvitDAaTOLXSYzi9rbC2kpZVG+ZKQ@mail.gmail.com> <9608d5c4-e60f-449e-9078-f27fed1f79fd@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1466504326 6902 80.91.229.3 (21 Jun 2016 10:18:46 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 21 Jun 2016 10:18:46 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCT7RVFA4QORBX5IUS5QKGQEIYXCCBA@isocpp.org Tue Jun 21 12:18:41 2016
Return-path: <std-proposals+bncBCT7RVFA4QORBX5IUS5QKGQEIYXCCBA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f72.google.com ([209.85.215.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCT7RVFA4QORBX5IUS5QKGQEIYXCCBA@isocpp.org>)
	id 1bFIl3-0003ea-Bw
	for gclcip-std-proposals@m.gmane.org; Tue, 21 Jun 2016 12:18:13 +0200
Original-Received: by mail-lf0-f72.google.com with SMTP id l184sf8667621lfl.3
        for <gclcip-std-proposals@m.gmane.org>; Tue, 21 Jun 2016 03:18:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=0WW0fcErFaKFl/ZvHfYdjdqG2OGHPeGMD/zQoNtazE8=;
        b=RHl31gxn7T+nMMl9b2dlGMvpSEhVWrQ5CiZCA0S6POrkFPsV89FT7GZKtvaSnl9888
         5raj1wHlcUNPH4BGl5vwY2nmBFcqgeefmVqA4qd+trdV6Jq7gX3t08kPfk0yUOupBSe0
         w5EDEnq6qYssWvHqJqK+waun7gEkNnbR9h+5d3KWgy6amgp6A51oDrA59FZAzDEA/Jed
         58jkH4H/LZ0Xay9z0kPplmF07IUHql547N3DTVVYapYVqjD5I0DVFdcVvBuPeNF1aLZz
         ytHtpBw9yLi2uJYEPxj5Zc1DUq6xGs4Zse4P27Cm23khg11sFsUJhu3xPY2YdzMnSlSa
         HmPw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=0WW0fcErFaKFl/ZvHfYdjdqG2OGHPeGMD/zQoNtazE8=;
        b=b4FYwbYJTaTR1ltHSPmKFRke6dKlc3qVhP3z1oAOtZSfPWCQ83Vr2yP7NnlHR/HUaG
         AYOdF9hApesgYeItHMCxQRRHID1+RE/fOEgRxXatmQk/0rcyC9rhMj6hfAme47Fgok86
         uXWxzQMdBXxpINirRVqvz0vaOP6DEHHp3qnG5hnYGwi4dTpQVbLoQvO+ly2JIsGkqz9q
         h4F607Ccwo+juKemN773dfNYNfjVAthPDyS4AfVP4gnHr/FlOQcydMnbUY8qZbN53fzA
         UfI3m6DRPkxiWR1gu5R9U9++YJsZOW1n08ZK1ROQkGMhJKK7ffiN/rl3HDA+4aPg6QEa
         x8xw==
X-Gm-Message-State: ALyK8tJ5jIH+dFlOPsRl2vPOupXvRDgrkS/mpfimHmnH0UMdRhUpfJ68sfECmq73xw3lMA==
X-Received: by 10.28.154.147 with SMTP id c141mr421893wme.2.1466504287894;
        Tue, 21 Jun 2016 03:18:07 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.46.71.147 with SMTP id u141ls305062lja.109.gmail; Tue, 21 Jun
 2016 03:18:06 -0700 (PDT)
X-Received: by 10.25.22.70 with SMTP id m67mr4753693lfi.25.1466504286604;
        Tue, 21 Jun 2016 03:18:06 -0700 (PDT)
Original-Received: from mail-lb0-x22e.google.com (mail-lb0-x22e.google.com. [2a00:1450:4010:c04::22e])
        by mx.google.com with ESMTPS id e63si29485824lfb.285.2016.06.21.03.18.06
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 21 Jun 2016 03:18:06 -0700 (PDT)
Received-SPF: pass (google.com: domain of daniel.kruegler@gmail.com designates 2a00:1450:4010:c04::22e as permitted sender) client-ip=2a00:1450:4010:c04::22e;
Original-Received: by mail-lb0-x22e.google.com with SMTP id o4so7600529lbp.2
        for <std-proposals@isocpp.org>; Tue, 21 Jun 2016 03:18:06 -0700 (PDT)
X-Received: by 10.195.10.131 with SMTP id ea3mr17960448wjd.86.1466504285936;
 Tue, 21 Jun 2016 03:18:05 -0700 (PDT)
Original-Received: by 10.28.168.148 with HTTP; Tue, 21 Jun 2016 03:18:05 -0700 (PDT)
In-Reply-To: <9608d5c4-e60f-449e-9078-f27fed1f79fd@isocpp.org>
X-Original-Sender: daniel.kruegler@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 daniel.kruegler@gmail.com designates 2a00:1450:4010:c04::22e as permitted
 sender) smtp.mailfrom=daniel.kruegler@gmail.com;       dmarc=pass (p=NONE
 dis=NONE) header.from=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:26366
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26366>

2016-06-21 12:12 GMT+02:00 FrankHB1989 <frankhb1989@gmail.com>:
> Call of std::exchange can work, but it seems not so ideal.

This is a misunderstanding of my possibly ambiguous response. I didn't
mean to use std::exchange, but instead I was trying to suggest that if
you were considering to reuse an existing name it should better be
exchange instead of swap.

> The return type
> of std::exchange is template parameter type T, so when T is a volatile type,
> lvalue-to-rvalue conversion would be performed, and there are likely more
> side effects than needed.
> I also don't think using the volatile lvalue return value (which is not the
> case for std::exchange) a good idea. Discarded-value expressions can work in
> such cases, but is seems to be strange and too error-prone. So perhaps the
> return type of the call should be void.
> Regarding with Swappable requriements and symmetry... how about providing 2
> overloading?

I still feel uneasy about it, especially when trying to make a
consistent sense with your suggested overloads (even assuming that
both overloads would be provided) and the Swappable post-conditions.
But again, I haven't thought carefully through it.

- Daniel

-- 
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/CAGNvRgCYLywvtFSO65-NKpeycpT4cPnw0SjvQPhE_DRL98UO7g%40mail.gmail.com.

.
