220 5903 <a65969ec-169a-474a-8770-318c57da6a2c@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: Tue, 27 Aug 2013 16:17:25 -0700 (PDT)
Lines: 161
Approved: news@gmane.org
Message-ID: <a65969ec-169a-474a-8770-318c57da6a2c@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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_14_24552669.1377645445978"
X-Trace: ger.gmane.org 1377645446 24518 80.91.229.3 (27 Aug 2013 23:17:26 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 27 Aug 2013 23:17:26 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBB7H6SIAKGQEGFDXPHY@isocpp.org Wed Aug 28 01:17:29 2013
Return-path: <std-proposals+bncBCEKFTV6ZUMBBB7H6SIAKGQEGFDXPHY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f198.google.com ([209.85.214.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBB7H6SIAKGQEGFDXPHY@isocpp.org>)
	id 1VESVs-0006gJ-Uq
	for gclcip-std-proposals@m.gmane.org; Wed, 28 Aug 2013 01:17:29 +0200
Original-Received: by mail-ob0-f198.google.com with SMTP id wc20sf20575548obb.9
        for <gclcip-std-proposals@m.gmane.org>; Tue, 27 Aug 2013 16:17:28 -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=5zjHyIHetEAqWetxJaGe4zuGE6IxVMjAlpEDs74ybeo=;
        b=SDgfwCI1haUYuJGQYblFNwDxFMR4V5Jtkz28Zj34eWlin4TUSBhgaTBNFdJBmGifPG
         GB1Un3Q9wdb2mtRiz/x4bcPd2EILq+U5b9d4ZXr+RSpz5iIG+KoZ49WqSXVC93qjEzO7
         jpfGc3AXuIC314YL0ZjDcGh2XDg/KreaQh+VRMaAZsB+0bvpM2iUDUh7wndXpnv8vr/R
         59aTj9b53r1J5n/ALCQK6bYe5juLLN6aZ+2mLYTOUKNm0LS0LLoUmIsxZr9mlD9/j0Yk
         O/o10d3fLSx/t8QiHAHU0PpMJL91N1nrFsJBVhVCTkB1gAO8rBHrRI3gINKSGvpZNmhh
         SLLQ==
X-Received: by 10.50.129.42 with SMTP id nt10mr12348493igb.0.1377645447915;
        Tue, 27 Aug 2013 16:17:27 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.3.70 with SMTP id a6ls3436535iga.44.canary; Tue, 27 Aug
 2013 16:17:26 -0700 (PDT)
X-Received: by 10.50.61.162 with SMTP id q2mr782133igr.10.1377645446918;
        Tue, 27 Aug 2013 16:17:26 -0700 (PDT)
In-Reply-To: <521C74C5.6060801@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:5903
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5903>

------=_Part_14_24552669.1377645445978
Content-Type: text/plain; charset=ISO-8859-1



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 <javascript:>> 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`.

There is no reason why this should be the case. A space-optimized object 
can be used separately.

-- 

--- 
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_14_24552669.1377645445978
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, August 27, 2013 2:43:33 AM UTC-7, Beng=
t Gustafsson wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;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 href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailt=
o=3D"Mz1mbb_j3g8J">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;T=
hat's not what I'm asking. &nbsp;I'm asking what is the benefit of this req=
uirement in the C++1y context? &nbsp;What problem does this requirement sol=
ve?
<br>&gt; Afaics, it makes the pointed object modifiable. &nbsp;And move_ite=
rator
<br>&gt; significantly benefits from it. &nbsp;(Here is something I'm not s=
ure:
<br>&gt; move_iterator requires only InputIterator, while dereferencing an
<br>&gt; InputIterator may return anything convertible to T -- is there any=
thing
<br>&gt; broken here?)
<br>&gt;
<br>No, he must be refering to something else, as the return value of=20
<br>vector&lt;bool&gt;::iterator::<wbr>operator* does indeed make the point=
ed object=20
<br>modifiable.
<br>
<br>I don't like when people speak in riddles to make other people feel lik=
e=20
<br>idiots! Please instead try to explain the issue at hand as clearly as=
=20
<br>you can.
<br>
<br>The prime example I have been given of the badness of the vector&lt;boo=
l&gt;=20
<br>specialization is that it does not have a .data() method. So be it, but=
=20
<br>in what case is using .data() preferred to using iterators?<br></blockq=
uote><div><br>Because it's part of std::vector's interface. std::vector *re=
quires* that this code works:<br><br><div class=3D"prettyprint" style=3D"ba=
ckground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); borde=
r-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"p=
rettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">vector</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{...};</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>T</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> tp </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">t</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">[</span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">];<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>tp </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">+=3D</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">3</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">tp </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D=3D</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">[</s=
pan><span style=3D"color: #066;" class=3D"styled-by-prettify">3</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">];</span></div></code>=
</div><br>And that will work for all T... so long as T is not `bool`.<br><b=
r>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>There is no reason why this should be the case. A space-optimized obje=
ct can be used separately.<br></div></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_14_24552669.1377645445978--

.
