220 5957 <05144456-e359-41a6-9b7c-82a0a926dd8d@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, 28 Aug 2013 15:32:17 -0700 (PDT)
Lines: 263
Approved: news@gmane.org
Message-ID: <05144456-e359-41a6-9b7c-82a0a926dd8d@isocpp.org>
References: <CAGsORuDQdeWAO5yjA6=h0hW9Y0Sj4F1gcHB61udw5JFmtx+g4Q@mail.gmail.com>	<b06daeb3-a585-4c55-aebf-cae643146838@isocpp.org>	<CAGg_6+O_d85CBjT+cTV6vQqepUTXVvUMV_QUioS6ELpQCav6GQ@mail.gmail.com>	<521B07D2.8070000@beamways.com>	<7d0bc129-f8aa-4803-bbd9-bd5ca504d728@isocpp.org>	<CAGsORuB8omCBfjco6i_zENDn23tx-5wg1jeHuhsGsiVMbGk+Ww@mail.gmail.com>	<77e0868c-6aed-4578-acc7-7cf1227465f6@isocpp.org>	<CAGsORuAAZChA8cyx4JTTqRmMNSGQXZyGdzrm9P0WVRMZSSg6Qw@mail.gmail.com>	<4E5B6BD9-363D-4B42-ACA3-029301F3F54E@gmail.com> <CAGsORuCDbX4k2ZOcnoR1QwfQoain5anNrm1as5wvpe38Vg=iow@mail.gmail.com> <521C74C5.6060801@beamways.com> <a65969ec-169a-474a-8770-318c57da6a2c@isocpp.org>
 <521DA66A.9060804@beamways.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_1586_16791137.1377729137499"
X-Trace: ger.gmane.org 1377729138 23856 80.91.229.3 (28 Aug 2013 22:32:18 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 28 Aug 2013 22:32:18 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCEKFTV6ZUMBB4XU7GIAKGQEABMSISI@isocpp.org Thu Aug 29 00:32:21 2013
Return-path: <std-proposals+bncBCEKFTV6ZUMBB4XU7GIAKGQEABMSISI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f200.google.com ([209.85.214.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBB4XU7GIAKGQEABMSISI@isocpp.org>)
	id 1VEoHk-0000PZ-FN
	for gclcip-std-proposals@m.gmane.org; Thu, 29 Aug 2013 00:32:20 +0200
Original-Received: by mail-ob0-f200.google.com with SMTP id wd6sf25712298obb.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 28 Aug 2013 15:32:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=2gPE2IepzyLexBXpWR7CULktg3zZf+V08jpA22DMgaM=;
        b=fSasFfXP0sA2uYPAFa0b4DsGX08iIF/eEh2q+07hOB1cyncHTvzrSTwg+u/DxjFrjV
         43dZtwi4Twr3X+h8tZKHISiZKiTO0LnnUiB4JQPcVr6ERO0lQ7Xax8Nw8bYCcuAv841p
         lE1pnWFwe5jlYKzNyJaKTqGnQe0wsUOf0Rnf5SB/e2u+fiu1MqJZtjFVNiBbkiHws30Z
         r/fm+QkIV3oOjMSGIBLf3EKnOkq80AzDduOU8kYN338Lf5CAAAOUd5MMqS0yI9AdtFxN
         imV9rTtZu6vn26UPf9yT6SjRM8xN2tGRWUMVbxF/xksboAs53RyDkRNYFKGNr4HgHpqr
         S/iw==
X-Received: by 10.43.50.9 with SMTP id vc9mr123533icb.16.1377729139393;
        Wed, 28 Aug 2013 15:32:19 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.1.36 with SMTP id 4ls907005igj.5.gmail; Wed, 28 Aug 2013
 15:32:18 -0700 (PDT)
X-Received: by 10.50.16.111 with SMTP id f15mr631747igd.2.1377729138481;
        Wed, 28 Aug 2013 15:32:18 -0700 (PDT)
In-Reply-To: <521DA66A.9060804@beamways.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>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:5957
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5957>

------=_Part_1586_16791137.1377729137499
Content-Type: text/plain; charset=ISO-8859-1



On Wednesday, August 28, 2013 12:27:38 AM UTC-7, Bengt Gustafsson wrote:
>
>  
> Nicol Bolas skrev 2013-08-28 01:17:
>  
>
>
> On Tuesday, August 27, 2013 2:43:33 AM UTC-7, Bengt Gustafsson wrote: 
>>
>>
>> Zhihao Yuan skrev 2013-08-27 01:57: 
>> > On Mon, Aug 26, 2013 at 7:22 PM, Howard Hinnant 
>> > <howard....@gmail.com> wrote: 
>> >> Question for Zhihao: 
>> >> 
>> >> Why does forward iterator's operator*() have to return a value_type& ? 
>> >> 
>> >> I'm well aware that this is what C++98/03/11 requires.  That's not 
>> what I'm asking.  I'm asking what is the benefit of this requirement in the 
>> C++1y context?  What problem does this requirement solve? 
>> > Afaics, it makes the pointed object modifiable.  And move_iterator 
>> > significantly benefits from it.  (Here is something I'm not sure: 
>> > move_iterator requires only InputIterator, while dereferencing an 
>> > InputIterator may return anything convertible to T -- is there anything 
>> > broken here?) 
>> > 
>> No, he must be refering to something else, as the return value of 
>> vector<bool>::iterator::operator* does indeed make the pointed object 
>> modifiable. 
>>
>> I don't like when people speak in riddles to make other people feel like 
>> idiots! Please instead try to explain the issue at hand as clearly as 
>> you can. 
>>
>> The prime example I have been given of the badness of the vector<bool> 
>> specialization is that it does not have a .data() method. So be it, but 
>> in what case is using .data() preferred to using iterators?
>>
>
> Because it's part of std::vector's interface. std::vector *requires* that 
> this code works:
>
>  vector<T> t{...};
> T* tp = &t[0];
> tp += 3;
> *tp == t[3];
>  
> And that will work for all T... so long as T is not `bool`.
>
> It is not for you to decide whether this is good code or not. That's the 
> interface that `vector` provides by the standard, and that is the interface 
> that we should expect to have. And we do... as long as T is not `bool`.
>
>   No, the standard says exactly what the standard says: The code above 
> should work for all T except bool. There is a special clause in the 
> standard detailing that vector<bool> is to be specialized to NOT work as 
> you claim. That's what we are discussing here, isn't it? You can claim that 
> we should change the standard because it is inconsistent or confusing but 
> can NOT claim that we should change the standard because it contradicts 
> itself!
>

Which is good because I never said *anything* about contradicting itself. 
You asked for someone to "explain the issue at hand", and I did. 
`vector<bool>` does not behave like a `vector` and it *should*. That's the 
issue at hand.

Personally I am indifferent, as I don't use vector<bool>. But I don't want 
> the standard to be changed under the feet of people, and I dislike that 
> more than it being clumsy as it is.
>

Have you read anything in this thread? The plan for changing this is to add 
a drop-in class that provides the same interface, so that people can simply 
find/replace within their code. Then we deprecate the `vector<bool>` 
specialization. It will still be there for at least one version alongside 
the stand-alone class. That way, everyone has several years and version 
releases to do that find/replace within their code to use the new class 
rather than `vector<bool>`.

And then we cut out the `vector<bool>` specialization. Nobody is suggesting 
that it be changed "under the feet of people". 

>  

-- 

--- 
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/.

------=_Part_1586_16791137.1377729137499
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, August 28, 2013 12:27:38 AM UTC-7, B=
engt Gustafsson wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20
   =20
 =20
  <div text=3D"#000000" bgcolor=3D"#FFFFFF">
    <br>
    <div>Nicol Bolas skrev 2013-08-28 01:17:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Tuesday, August 27, 2013 2:43:33 AM UTC-7, Bengt Gustafsson
        wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
          <br>
          Zhihao Yuan skrev 2013-08-27 01:57:
          <br>
          &gt; On Mon, Aug 26, 2013 at 7:22 PM, Howard Hinnant
          <br>
          &gt; &lt;<a>howard....@gmail.com</a>&gt;
          wrote:
          <br>
          &gt;&gt; Question for Zhihao:
          <br>
          &gt;&gt;
          <br>
          &gt;&gt; Why does forward iterator's operator*() have to
          return a value_type&amp; ?
          <br>
          &gt;&gt;
          <br>
          &gt;&gt; I'm well aware that this is what C++98/03/11
          requires. &nbsp;That's not what I'm asking. &nbsp;I'm asking what=
 is the
          benefit of this requirement in the C++1y context? &nbsp;What
          problem does this requirement solve?
          <br>
          &gt; Afaics, it makes the pointed object modifiable. &nbsp;And
          move_iterator
          <br>
          &gt; significantly benefits from it. &nbsp;(Here is something I'm
          not sure:
          <br>
          &gt; move_iterator requires only InputIterator, while
          dereferencing an
          <br>
          &gt; InputIterator may return anything convertible to T -- is
          there anything
          <br>
          &gt; broken here?)
          <br>
          &gt;
          <br>
          No, he must be refering to something else, as the return value
          of <br>
          vector&lt;bool&gt;::iterator::<wbr>operator* does indeed make
          the pointed object <br>
          modifiable.
          <br>
          <br>
          I don't like when people speak in riddles to make other people
          feel like <br>
          idiots! Please instead try to explain the issue at hand as
          clearly as <br>
          you can.
          <br>
          <br>
          The prime example I have been given of the badness of the
          vector&lt;bool&gt; <br>
          specialization is that it does not have a .data() method. So
          be it, but <br>
          in what case is using .data() preferred to using iterators?<br>
        </blockquote>
        <div><br>
          Because it's part of std::vector's interface. std::vector
          *requires* that this code works:<br>
          <br>
          <div style=3D"background-color:rgb(250,250,250);border-color:rgb(=
187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><cod=
e>
              <div><span style=3D"color:#000">vector</span><span style=3D"c=
olor:#660">&lt;</span><span style=3D"color:#000">T</span><span style=3D"col=
or:#660">&gt;</span><span style=3D"color:#000"> t</span><span style=3D"colo=
r:#660">{...};</span><span style=3D"color:#000"><br>
                  T</span><span style=3D"color:#660">*</span><span style=3D=
"color:#000"> tp </span><span style=3D"color:#660">=3D</span><span style=3D=
"color:#000"> </span><span style=3D"color:#660">&amp;</span><span style=3D"=
color:#000">t</span><span style=3D"color:#660">[</span><span style=3D"color=
:#066">0</span><span style=3D"color:#660">];</span><span style=3D"color:#00=
0"><br>
                  tp </span><span style=3D"color:#660">+=3D</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#066">3</span><span style=3D=
"color:#660">;</span><span style=3D"color:#000"><br>
                </span><span style=3D"color:#660">*</span><span style=3D"co=
lor:#000">tp </span><span style=3D"color:#660">=3D=3D</span><span style=3D"=
color:#000"> t</span><span style=3D"color:#660">[</span><span style=3D"colo=
r:#066">3</span><span style=3D"color:#660">];</span></div>
            </code></div>
          <br>
          And that will work for all T... so long as T is not `bool`.<br>
          <br>
          It is not for you to decide whether this is good code or not.
          That's the interface that `vector` provides by the standard,
          and that is the interface that we should expect to have. And
          we do... as long as T is not `bool`.<br>
          <br>
        </div>
      </div>
    </blockquote>
    No, the standard says exactly what the standard says: The code above
    should work for all T except bool. There is a special clause in the
    standard detailing that vector&lt;bool&gt; is to be specialized to
    NOT work as you claim. That's what we are discussing here, isn't it?
    You can claim that we should change the standard because it is
    inconsistent or confusing but can NOT claim that we should change
    the standard because it contradicts itself!<br></div></blockquote><div>=
<br>Which is good because I never said <i>anything</i> about contradicting =
itself. You asked for someone to "explain the issue at hand", and I did. `v=
ector&lt;bool&gt;` does not behave like a `vector` and it <i>should</i>. Th=
at's the issue at hand.<br><br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left:=
 1ex;"><div text=3D"#000000" bgcolor=3D"#FFFFFF">
   =20
    Personally I am indifferent, as I don't use vector&lt;bool&gt;. But
    I don't want the standard to be changed under the feet of people,
    and I dislike that more than it being clumsy as it is.</div></blockquot=
e><div><br>Have you read anything in this thread? The plan for changing thi=
s is to add a drop-in class that provides the same interface, so that peopl=
e can simply find/replace within their code. Then we deprecate the `vector&=
lt;bool&gt;` specialization. It will still be there for at least one versio=
n alongside the stand-alone class. That way, everyone has several years and=
 version releases to do that find/replace within their code to use the new =
class rather than `vector&lt;bool&gt;`.<br><br>And then we cut out the `vec=
tor&lt;bool&gt;` specialization. Nobody is suggesting that it be changed "u=
nder the feet of people".
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div text=3D"#000000" bg=
color=3D"#FFFFFF">
  </div>

</blockquote></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/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1586_16791137.1377729137499--

.
