220 5855 <CA+cyFgvGeOJQSfXAQg3z2TKXvFY-OYvhp6_EGMx_mxoskys7LQ@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Geoffrey Romer <gromer@google.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Remove vector<bool>?
Date: Mon, 26 Aug 2013 17:16:55 -0700
Lines: 148
Approved: news@gmane.org
Message-ID: <CA+cyFgvGeOJQSfXAQg3z2TKXvFY-OYvhp6_EGMx_mxoskys7LQ@mail.gmail.com>
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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=047d7bd6afda561e4a04e4e2ca5f
X-Trace: ger.gmane.org 1377562615 24898 80.91.229.3 (27 Aug 2013 00:16:55 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 27 Aug 2013 00:16:55 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD74DCN5SYHBB56756IAKGQER2M32EA@isocpp.org Tue Aug 27 02:16:57 2013
Return-path: <std-proposals+bncBD74DCN5SYHBB56756IAKGQER2M32EA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vc0-f200.google.com ([209.85.220.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD74DCN5SYHBB56756IAKGQER2M32EA@isocpp.org>)
	id 1VE6xs-0001FV-N5
	for gclcip-std-proposals@m.gmane.org; Tue, 27 Aug 2013 02:16:56 +0200
Original-Received: by mail-vc0-f200.google.com with SMTP id hf12sf4393819vcb.7
        for <gclcip-std-proposals@m.gmane.org>; Mon, 26 Aug 2013 17:16:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=nF3EkWuBWsqtCUXaysVUxhiZoZmjacQYxYwO9jUab08=;
        b=g5mj2mz66ttKuI63fgBdZfhKid5qDnFiLUX2PZc8fpXjXmWdWsP1g/DlhemGX2k80o
         DEeQ+HR1QPGOF7BEPY3alRzgysRX3qHwghThWNwrLQ827CL4xrlNtuyqwfKZM83nbH9N
         6oS3v89hJFF6X4SJoqlWYa5bu5Cvnl5P7ffElN4ZTnhfrR1P8No1pbuqHXsgvuRl+J3Y
         ugAd8aXBp+9yuLPBkPPp0lnR9IQftB6OdIQYErH4/9Yz+YOpUjardBpE9ssBMW0jdYiA
         XB2VnOQ0TdegFjeOtKa2dhDROvDsAv/KopA4yMOYuBVk48xfsNrce308uKYbItgqT22s
         Xe4g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=nF3EkWuBWsqtCUXaysVUxhiZoZmjacQYxYwO9jUab08=;
        b=jlKg0V5i6JR6XI1nOXC6iEuH8MMZYtRZpU/aZtOLTe950bGvBw01ItjiUseVXMpMop
         QyxEDnTqXv0Ao7lQ6bXT0+38bbdYeweaFWIp3lwCtdybDb4fePi+zeh7Tu53aqcI1W5V
         YbfCZa+Po10h07UgD60YoS46Y3yYKANfXK36nFDIUU2aHyk2cXpSlAZdvwiW8EZB29qY
         Urp7VoWgFOO9Z/kp6i64ggB5n2L6olAIj6OK0qF9uL4tFc3i5CPOOWl1OUFDPILAPzFv
         DRb6gRpoXc2ju6zDn7eLvn9p8hzgqDdVWdrx0AZ+zKtCTOpj+dQJQPb0/KUJCZH9/KlO
         JoFQ==
X-Received: by 10.236.209.103 with SMTP id r67mr6894774yho.35.1377562615831;
        Mon, 26 Aug 2013 17:16:55 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.16.200 with SMTP id i8ls2665729qed.65.gmail; Mon, 26 Aug
 2013 17:16:55 -0700 (PDT)
X-Received: by 10.229.53.67 with SMTP id l3mr4864418qcg.66.1377562615406;
        Mon, 26 Aug 2013 17:16:55 -0700 (PDT)
Original-Received: from mail-qc0-x22e.google.com (mail-qc0-x22e.google.com [2607:f8b0:400d:c01::22e])
        by mx.google.com with ESMTPS id h5si6557447qej.147.1969.12.31.16.00.00
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 26 Aug 2013 17:16:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of gromer@google.com designates 2607:f8b0:400d:c01::22e as permitted sender) client-ip=2607:f8b0:400d:c01::22e;
Original-Received: by mail-qc0-f174.google.com with SMTP id e10so1511378qcy.33
        for <std-proposals@isocpp.org>; Mon, 26 Aug 2013 17:16:55 -0700 (PDT)
X-Gm-Message-State: ALoCoQnOkb/T/LJV6FVrokD1VhWSS1L08g2/GPrZy4wtwS+gpE4vUguqxhyOjyWJmYcss5Dr56Pue91XWtdi6aEjbPXsFRLBFPkIMbmRR8hEgKTnHWcyB/ZU2uxADtqumCKkykGUjh2OQOymBIZUw9PhU/H9bjjymV11ljIWKi7cCp5yBYh5H22fCYFtMoAGa9kqr3sT+VrSrUyqnWUrPpnKCA8DUgtogQ==
X-Received: by 10.49.88.97 with SMTP id bf1mr20178924qeb.38.1377562615204;
 Mon, 26 Aug 2013 17:16:55 -0700 (PDT)
Original-Received: by 10.49.12.228 with HTTP; Mon, 26 Aug 2013 17:16:55 -0700 (PDT)
In-Reply-To: <4E5B6BD9-363D-4B42-ACA3-029301F3F54E@gmail.com>
X-Original-Sender: gromer@google.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gromer@google.com designates 2607:f8b0:400d:c01::22e as permitted
 sender) smtp.mail=gromer@google.com;       dkim=pass header.i=@google.com;
       dmarc=pass (p=REJECT dis=NONE) d=google.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:5855
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5855>

--047d7bd6afda561e4a04e4e2ca5f
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Aug 26, 2013 at 4:22 PM, Howard Hinnant <howard.hinnant@gmail.com>wrote:

>
> On Aug 26, 2013, at 7:18 PM, Zhihao Yuan <zy@miator.net> wrote:
>
> > So you mean it's Okey for bitvector's begin() to produce an
> > object which can be used in any STL algorithms but such an object
> > fits into no iterator categories?  Don't you think that's an anti-pattern
> > of STL design?
>
> 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?
>


I'm not Zhihao, but...

One problem this solves is that code like this is guaranteed to work:

template <typename iter_t>
value_type& GetValue(iter_t iter) {
  return *iter;
}

If operator* can return a proxy with an implicit conversion to value_type,
GetValue is at serious risk of undefined behavior. I've seen multiple real
bugs in the wild arising from this problem, and they are truly heinous to
diagnose (they've led to a concerted effort to purge Boost.ptr_container, a
repeat offender in this respect, from our codebase).

This is not a knock-down objection, but it's an important cost to bear in
mind.


> Howard
>
> --
>
> ---
> 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/.
>

-- 

--- 
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/.

--047d7bd6afda561e4a04e4e2ca5f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><div class=3D"gmail_quote">=
On Mon, Aug 26, 2013 at 4:22 PM, Howard Hinnant <span dir=3D"ltr">&lt;<a hr=
ef=3D"mailto:howard.hinnant@gmail.com" target=3D"_blank">howard.hinnant@gma=
il.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div class=3D"im"><br>
On Aug 26, 2013, at 7:18 PM, Zhihao Yuan &lt;<a href=3D"mailto:zy@miator.ne=
t">zy@miator.net</a>&gt; wrote:<br>
<br>
&gt; So you mean it&#39;s Okey for bitvector&#39;s begin() to produce an<br=
>
&gt; object which can be used in any STL algorithms but such an object<br>
&gt; fits into no iterator categories? =A0Don&#39;t you think that&#39;s an=
 anti-pattern<br>
&gt; of STL design?<br>
<br>
</div>Question for Zhihao:<br>
<br>
Why does forward iterator&#39;s operator*() have to return a value_type&amp=
; ?</blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-le=
ft-style:solid;padding-left:1ex">

<br>
I&#39;m well aware that this is what C++98/03/11 requires. =A0That&#39;s no=
t what I&#39;m asking. =A0I&#39;m asking what is the benefit of this requir=
ement in the C++1y context? =A0What problem does this requirement solve?<br=
>
</blockquote><div><br></div><div><div><br class=3D"">I&#39;m not=A0Zhihao, =
but...</div><div><br></div><div>One problem this solves is that code like t=
his is guaranteed to work:</div><div><br></div><div>template &lt;typename i=
ter_t&gt;</div>
<div>value_type&amp; GetValue(iter_t iter) {</div><div>=A0 return *iter;</d=
iv><div>}</div><div><br></div><div>If operator* can return a proxy with an =
implicit conversion to value_type, GetValue is at serious risk of undefined=
 behavior. I&#39;ve seen multiple real bugs in the wild arising from this p=
roblem, and they are truly heinous to diagnose (they&#39;ve led to a concer=
ted effort to purge Boost.ptr_container, a repeat offender in this respect,=
 from our codebase).</div>
<div><br></div><div>This is not a knock-down objection, but it&#39;s an imp=
ortant cost to bear in mind.</div><div><br></div></div><blockquote class=3D=
"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;borde=
r-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<span class=3D""><font color=3D"#888888"><br>
Howard<br>
</font></span><div class=3D""><div class=3D"h5"><br>
--<br>
<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 <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><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 />

--047d7bd6afda561e4a04e4e2ca5f--

.
