220 2779 <5115987B.5000507@gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?ISO-8859-1?Q?Mikael_Kilpel=E4inen?=
 <mikael.kilpelainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: A proposal to add swap traits to the standard library
Date: Sat, 09 Feb 2013 01:29:47 +0100
Lines: 38
Approved: news@gmane.org
Message-ID: <5115987B.5000507@gmail.com>
References: <CA+Acj4fnCPDP2wPVts1B4Zaz6xzZ899=A=6ShTUqw_Ep5gN7pg@mail.gmail.com> <713d1419-a642-408c-b3ba-44d1a17c2bb8@isocpp.org> <511227BD.9010306@gmail.com> <536643f8-e7bd-447c-8515-6829c42f8425@isocpp.org> <51127060.7010505@gmail.com> <f8e4cfdd-2ece-45a5-82cc-bf9f15549663@isocpp.org> <8AB4D2A8-9E07-47C9-9F72-E5DD6D11B1FA@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
X-Trace: ger.gmane.org 1360369796 6429 80.91.229.3 (9 Feb 2013 00:29:56 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 9 Feb 2013 00:29:56 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDHYRTPW4EBRBA5R22EAKGQEWVGAUEA@isocpp.org Sat Feb 09 01:30:17 2013
Return-path: <std-proposals+bncBDHYRTPW4EBRBA5R22EAKGQEWVGAUEA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-bk0-f69.google.com ([209.85.214.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDHYRTPW4EBRBA5R22EAKGQEWVGAUEA@isocpp.org>)
	id 1U3yKd-0000qQ-30
	for gclcip-std-proposals@m.gmane.org; Sat, 09 Feb 2013 01:30:15 +0100
Original-Received: by mail-bk0-f69.google.com with SMTP id q16sf4569616bkw.8
        for <gclcip-std-proposals@m.gmane.org>; Fri, 08 Feb 2013 16:29:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:x-received:received-spf
         :x-received: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=DULyrosNnycUUTGE9m1AJ57JyOIwUF6tzedrdt3Jzb8=;
        b=RmzDxknkLNVabnBT6rd+ho8zw4fG52oPJJIsBrSyWggg3umBvq9T5ZYOW5xooiztLQ
         5/4aQnT4rbfzpLtcrfbVo3+kj/dIZK+Y1e3ON80Yb/WXuXuA6d0Oib4li5dk+FlcYPiY
         fhDG3qvvlE3zJqWMe6uCWdyZt+mfRQVgMAIoWU4zyxJfOVUoTXWRLsk6q1uztgEFYWOr
         L4aCL9wXL+bJBiJfheJAWwIPapCzyfM+CZDHuYp/Ykod9/xNVoi/BdTlCRGf9bh+ZePH
         GSH2jVbn0Zt+QZbfxJzsLznwtWsAV9lnOTO1y3 
X-Received: by 10.180.8.132 with SMTP id r4mr735505wia.0.1360369796104;
        Fri, 08 Feb 2013 16:29:56 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.84.67 with SMTP id w3ls447656wiy.53.canary; Fri, 08 Feb
 2013 16:29:55 -0800 (PST)
X-Received: by 10.204.5.140 with SMTP id 12mr1993093bkv.18.1360369795585;
        Fri, 08 Feb 2013 16:29:55 -0800 (PST)
X-Received: by 10.204.5.140 with SMTP id 12mr1993092bkv.18.1360369795547;
        Fri, 08 Feb 2013 16:29:55 -0800 (PST)
Original-Received: from mail-bk0-f43.google.com (mail-bk0-f43.google.com [209.85.214.43])
        by mx.google.com with ESMTPS id gy11si23676159bkc.60.2013.02.08.16.29.54
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 08 Feb 2013 16:29:54 -0800 (PST)
Received-SPF: pass (google.com: domain of mikael.kilpelainen@gmail.com designates 209.85.214.43 as permitted sender) client-ip=209.85.214.43;
Original-Received: by mail-bk0-f43.google.com with SMTP id jm19so1907955bkc.2
        for <std-proposals@isocpp.org>; Fri, 08 Feb 2013 16:29:54 -0800 (PST)
X-Received: by 10.205.136.205 with SMTP id il13mr533812bkc.93.1360369794351;
        Fri, 08 Feb 2013 16:29:54 -0800 (PST)
Original-Received: from [192.168.1.72] (koln-4db42936.pool.mediaWays.net. [77.180.41.54])
        by mx.google.com with ESMTPS id fs20sm10653244bkc.8.2013.02.08.16.29.53
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 08 Feb 2013 16:29:53 -0800 (PST)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
In-Reply-To: <8AB4D2A8-9E07-47C9-9F72-E5DD6D11B1FA@gmail.com>
X-Original-Sender: mikael.kilpelainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of mikael.kilpelainen@gmail.com designates 209.85.214.43 as permitted
 sender) smtp.mail=mikael.kilpelainen@gmail.com;       dkim=pass header.i=@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?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:2779
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2779>

9.2.2013 0:36, Howard Hinnant kirjoitti:
> For me here is the poster-child for heterogeneous swap:
>
> #include <vector>
> #include <iostream>
>
> int main()
> {
>      std::vector<bool> v(1);
>      bool b = true;
>      swap(b, v[0]);
>      std::cout << v[0] << '\n';
> }
>
> The standard doesn't say this should work, but imho the standard is broken in that regard.  It works in libc++ just as a personal expression of defiance. :-)  Not sure if/where else.
I agree something like this should work, but vector<bool> is rather 
special anyhow. The fix seems quite trivial for this specific case 
though, did you have some more generic
problem in mind which i just failed to see?

>
> I don't know of a case where a heterogeneous swap is useful for being explicitly heterogeneous.  It is usually useful as trying to masquerade as a homogeneous swap.
>
I think so too. Can you think of other "common" examples than vector<bool>?


Mikael

-- 

--- 
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/?hl=en.



.
