220 26362 <CAGNvRgB9K2W=AL5y3b7PbVvitDAaTOLXSYzi9rbC2kpZVG+ZKQ@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 09:49:54 +0200
Lines: 26
Approved: news@gmane.org
Message-ID: <CAGNvRgB9K2W=AL5y3b7PbVvitDAaTOLXSYzi9rbC2kpZVG+ZKQ@mail.gmail.com>
References: <81998cb5-722e-49a1-be98-7ca1e219b72a@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 1466495402 28439 80.91.229.3 (21 Jun 2016 07:50:02 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 21 Jun 2016 07:50:02 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCT7RVFA4QORBJHDUO5QKGQEFI62RYA@isocpp.org Tue Jun 21 09:49:58 2016
Return-path: <std-proposals+bncBCT7RVFA4QORBJHDUO5QKGQEFI62RYA@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+bncBCT7RVFA4QORBJHDUO5QKGQEFI62RYA@isocpp.org>)
	id 1bFGRa-0003d0-5y
	for gclcip-std-proposals@m.gmane.org; Tue, 21 Jun 2016 09:49:58 +0200
Original-Received: by mail-lf0-f72.google.com with SMTP id a4sf5477936lfa.1
        for <gclcip-std-proposals@m.gmane.org>; Tue, 21 Jun 2016 00:49:57 -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=BIuK0DIKW9rxdfKTAADUnpn7M274pJdXG7ZJElB1u5s=;
        b=bZsmHJ20Hg3izFhlWyaUFEAcS8aiPQikrdmxSgbFWGQ+GvpslyCW7uLvsPbwZouVBp
         9HShs++loxWBBAlMpKTYNwquENhQjGygn0QpK1DGGASROG3T44/DncjndYyKQ/zQ7aTn
         uuV+0j4hyFmibv4KmsBfv4+ttI+uJgH/hII51iFz9iT/mb8yalsAmLifVfinaKQZA8Fp
         id0XcVHotGAj4hlT8gpIOBK85zYw372CGC7mTqaQ9X/rKfcykbzvXjyTDB0I1Bd/Fx4E
         GUm6Qku7/M71yyVbtQxWqJ7eftQ1GrnzF3HtLl0C1eKQMVDYiFyT7fSteXzXKMUivUoI
         E6JQ==
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=BIuK0DIKW9rxdfKTAADUnpn7M274pJdXG7ZJElB1u5s=;
        b=XWC3A6VGAAArgbhV3GJIGKLIXc/7gL4UG5mjgtdTAnmZRElPIdJdS5bHBSolrz7elt
         Wm/LR+AkXH7AZUhSP5Pi/D5DmMxpeycJpFWL3YNYPVx9jmVet0DNWAK+fqJW+N0P7qFw
         bqhGrjuQUl8APGh6VW+B8jTH5yMg3hAVoQNGYdykN/KNKUEqr3ctdj17JyxlpvYDxD6d
         3z+STSkwaYv0Lgh/+3P2huvy2lUw5zAL+LcRsA96q1OTRS8mFBDTqRJjqG0isbFRB6R6
         BzvukFDEFjgT96U55kLY+XVG1ucmEAnGYexFK1nFiqEGBeAww7dMb3Z78F+aFIye8a3p
         QncQ==
X-Gm-Message-State: ALyK8tKI/6I+xG9T0E3o2M+7Y9FiRk/eaPf4wFMnR7eq9pBqsXPUALIB121cg5goI9xU3g==
X-Received: by 10.28.166.73 with SMTP id p70mr291697wme.0.1466495397567;
        Tue, 21 Jun 2016 00:49:57 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.25.18.84 with SMTP id h81ls133639lfi.23.gmail; Tue, 21 Jun
 2016 00:49:55 -0700 (PDT)
X-Received: by 10.25.207.5 with SMTP id f5mr5950817lfg.45.1466495395959;
        Tue, 21 Jun 2016 00:49:55 -0700 (PDT)
Original-Received: from mail-lb0-x236.google.com (mail-lb0-x236.google.com. [2a00:1450:4010:c04::236])
        by mx.google.com with ESMTPS id g77si28777395lfi.3.2016.06.21.00.49.55
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 21 Jun 2016 00:49:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of daniel.kruegler@gmail.com designates 2a00:1450:4010:c04::236 as permitted sender) client-ip=2a00:1450:4010:c04::236;
Original-Received: by mail-lb0-x236.google.com with SMTP id xp5so4893319lbb.0
        for <std-proposals@isocpp.org>; Tue, 21 Jun 2016 00:49:55 -0700 (PDT)
X-Received: by 10.195.10.131 with SMTP id ea3mr17338779wjd.86.1466495395416;
 Tue, 21 Jun 2016 00:49:55 -0700 (PDT)
Original-Received: by 10.28.168.148 with HTTP; Tue, 21 Jun 2016 00:49:54 -0700 (PDT)
In-Reply-To: <81998cb5-722e-49a1-be98-7ca1e219b72a@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::236 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:26362
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26362>

2016-06-21 9:29 GMT+02:00 FrankHB1989 <frankhb1989@gmail.com>:
> I find swapping between the non-volatile and volatile lvalues may be useful,
> e.g. to save/restore errno where it has volatile type. Though it is easy to
> roll my own wheels, is it being considered in the standard, e.g.
> `template<typename T>void swap(T, volatile&) noexcept`?

The way you suggest to provide this (asymmetric) signature, to me that
doesn't seem to be a function that should be named swap and should be
considered during overload resolution of swap functions in the library
as described in [swappable.requirements]. For example, note that
according to the Swappable requirements, there exist a bunch of
requirements regarding symmetry of call expressions and
post-conditions, that don't seem to apply here.

I have not looked deeper into this, but isn't your suggestion more
indicated to be a variant of std::exchange? But even here I'm not 100%
sure that this picture fits.

- 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/CAGNvRgB9K2W%3DAL5y3b7PbVvitDAaTOLXSYzi9rbC2kpZVG%2BZKQ%40mail.gmail.com.

.
