220 4707 <83a68179-f8cd-42e9-a880-2bd797b30c28@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Remove vector<bool>?
Date: Wed, 29 May 2013 10:42:57 -0700 (PDT)
Lines: 96
Approved: news@gmane.org
Message-ID: <83a68179-f8cd-42e9-a880-2bd797b30c28@isocpp.org>
References: <CAGsORuDQdeWAO5yjA6=h0hW9Y0Sj4F1gcHB61udw5JFmtx+g4Q@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_4630_25315416.1369849377363"
X-Trace: ger.gmane.org 1369849380 18121 80.91.229.3 (29 May 2013 17:43:00 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 29 May 2013 17:43:00 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBI74TCGQKGQEQVVOGNY@isocpp.org Wed May 29 19:43:01 2013
Return-path: <std-proposals+bncBCEKFTV6ZUMBBI74TCGQKGQEQVVOGNY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f199.google.com ([209.85.223.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBI74TCGQKGQEQVVOGNY@isocpp.org>)
	id 1UhkOq-0001zh-U9
	for gclcip-std-proposals@m.gmane.org; Wed, 29 May 2013 19:43:01 +0200
Original-Received: by mail-ie0-f199.google.com with SMTP id 9sf13672622iec.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 29 May 2013 10:43:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:date:from:to:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=p18hlLCnhT4oVMtU3HdyW5PaM0HtAVeMW9ml2yY1N/c=;
        b=AO57RWdNib0D1z81+e6zExSrvp847YS25GkK691aBs32oS316FM+PfChm9i2ch0Ewb
         /mVS5oO3be2qJjLiz/RVarX38cfb+v0PM/uqj/GbIMgXxu/eX4YxmSsi1Pay9qQLYG8Z
         sSd5FAZ5RbO1v9bS5U1X27QpISTrGBj8nXBEQgrDk7lGI32TuMn20iKlSsj1hNyWXykS
         Jca0aXbzXSrkYBEMYI76UUxMKcfblMXijVMCoUCHHjWOl/flV1uKP7qhH2ba0chnsIGU
         weOb8yxUwcmr+idwvbtaVRGT73h7B7XqiodarkFyKZPMD0zoavdY8OGfXGXv8RNVpRuX
         r2SQ==
X-Received: by 10.50.50.102 with SMTP id b6mr3201100igo.5.1369849380006;
        Wed, 29 May 2013 10:43:00 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.159.133 with SMTP id xc5ls3624200igb.3.canary; Wed, 29 May
 2013 10:42:58 -0700 (PDT)
X-Received: by 10.50.50.204 with SMTP id e12mr2468589igo.0.1369849378599;
        Wed, 29 May 2013 10:42:58 -0700 (PDT)
In-Reply-To: <CAGsORuDQdeWAO5yjA6=h0hW9Y0Sj4F1gcHB61udw5JFmtx+g4Q@mail.gmail.com>
X-Original-Sender: jmckesson@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:4707
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4707>

------=_Part_4630_25315416.1369849377363
Content-Type: text/plain; charset=ISO-8859-1

On Tuesday, May 28, 2013 8:50:23 AM UTC-7, Zhihao Yuan wrote:
>
> I saw Herb's paper: 
>
>   http://www.gotw.ca/publications/N1185.pdf 
>
> But it's not adopted. 
>
> Anyway, vector<bool> sucks, and we know it.  How about to entirely 
> remove it? 
>

I think I may have a solution to this problem. The goal is to have a 
`vector` class that contains actual `bool`s, right? Well, who says that it 
actually *needs* to be called "vector<bool>"?

We simply add another specialization to `vector` called 
"vector<std::real_bool, Allocator>". If you create a `vector` with the 
`std::real_bool` type, then you get exactly what you would have gotten if 
`vector<bool>` weren't a specialization: an actual `vector` that contains 
actual `bool`s. The `value_type` of `vector<std::real_bool>` would be 
`bool`, and so forth.

We don't have to get rid of `vector<bool>` to get what we want. We just 
have to call it something else. And since this `std::real_bool` type can't 
be used in existing code (defining new things in the `std` namespace is 
undefined behavior), it can't conflict with anything now.

The downside is that a template function that takes a `vector<T>`, where 
`T` is some type, may assume that `T` is the `value_type` of the `vector`, 
which it would not be in the case of `std::real_bool`.

-- 

--- 
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.



------=_Part_4630_25315416.1369849377363
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Tuesday, May 28, 2013 8:50:23 AM UTC-7, Zhihao Yuan wrote:<blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;">I saw Herb's paper:
<br>
<br>&nbsp; <a href=3D"http://www.gotw.ca/publications/N1185.pdf" target=3D"=
_blank">http://www.gotw.ca/<wbr>publications/N1185.pdf</a>
<br>
<br>But it's not adopted.
<br>
<br>Anyway, vector&lt;bool&gt; sucks, and we know it. &nbsp;How about to en=
tirely
<br>remove it?
<br></blockquote><div><br>I think I may have a solution to this problem. Th=
e goal is to have a `vector` class that contains actual `bool`s, right? Wel=
l, who says that it actually <i>needs</i> to be called "vector&lt;bool&gt;"=
?<br><br>We simply add another specialization to `vector` called "vector&lt=
;std::real_bool, Allocator&gt;". If you create a `vector` with the `std::re=
al_bool` type, then you get exactly what you would have gotten if `vector&l=
t;bool&gt;` weren't a specialization: an actual `vector` that contains actu=
al `bool`s. The `value_type` of `vector&lt;std::real_bool&gt;` would be `bo=
ol`, and so forth.<br><br>We don't have to get rid of `vector&lt;bool&gt;` =
to get what we want. We just have to call it something else. And since this=
 `std::real_bool` type can't be used in existing code (defining new things =
in the `std` namespace is undefined behavior), it can't conflict with anyth=
ing now.<br><br>The downside is that a template function that takes a `vect=
or&lt;T&gt;`, where `T` is some type, may assume that `T` is the `value_typ=
e` of the `vector`, which it would not be in the case of `std::real_bool`.<=
br></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/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_4630_25315416.1369849377363--

.
