220 7653 <CAPBZbvzGVPmNtB+a_O=xp7hk_ZVGPX3rfNGtU17t3GbOrYqAbQ@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: "Billy O'Neal" <billy.oneal@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Could we remove the size() method in the std::list<T>?
Date: Sat, 9 Nov 2013 10:00:58 -0800
Lines: 309
Approved: news@gmane.org
Message-ID: <CAPBZbvzGVPmNtB+a_O=xp7hk_ZVGPX3rfNGtU17t3GbOrYqAbQ@mail.gmail.com>
References: <9be1f793-a061-4193-8a91-eedc81fa703e@isocpp.org>
 <433a9ee1-0ae3-4af7-ad93-028e416075ad@isocpp.org> <CAKQj7N6ofpADmHuo-xzVV9KgYwjSVyTVCUy8RDwHynkOrfJf2A@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=e89a8ff1ce0257ee5d04eac24a1f
X-Trace: ger.gmane.org 1384020095 19663 80.91.229.3 (9 Nov 2013 18:01:35 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 9 Nov 2013 18:01:35 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDKLBLVE6ADBBA7R7GJQKGQEHFCHKOA@isocpp.org Sat Nov 09 19:01:42 2013
Return-path: <std-proposals+bncBDKLBLVE6ADBBA7R7GJQKGQEHFCHKOA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f198.google.com ([209.85.223.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDKLBLVE6ADBBA7R7GJQKGQEHFCHKOA@isocpp.org>)
	id 1VfCqq-0007q8-Ow
	for gclcip-std-proposals@m.gmane.org; Sat, 09 Nov 2013 19:01:41 +0100
Original-Received: by mail-ie0-f198.google.com with SMTP id tp5sf10396555ieb.9
        for <gclcip-std-proposals@m.gmane.org>; Sat, 09 Nov 2013 10:01:39 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject: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=ioZ0hNSI5sGfVNpduzTYxL9SG1N4Yw9/DysPEZzNzuw=;
        b=T5M+3BblYb8qwGe8SS16D6b1mc0S9ybB3hl1GVnz7BJtDvHmGDD6bWrpu/K/sRAcZy
         5meY0rusudww0VLOvTIAlk0Tm5nJsGJriOJ07hgmaMlC26oWhH0mKcvMi9EqDE58JysA
         /v0nvq0FY/oHQ30+LT5tT/ne9ocekaqfJac6KYad1tG4V2/H9qX66E9tF2ZXaAmS3EYq
         9M6C3MkdEpEyJ+6uWUMYihBUJRYNPinllwTQaQkV65/i2yujwxAdzzGXZF7+cxlh88U/
         K5oSMbHK0vJn/c9Q2Goq761iXvT1MXg4NC8LesBeMS9Kh365a7cCY5hq3tFIq/2CjdMF
         YduQ==
X-Gm-Message-State: ALoCoQnz1UR+0VxWElCDkak4jlp9my+h8AqIdiSJdd0ppbGyz4kWpJ2Qs464v/ZkBT+H7H7xqaAG
X-Received: by 10.42.179.10 with SMTP id bo10mr5359525icb.8.1384020099778;
        Sat, 09 Nov 2013 10:01:39 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.112.231 with SMTP id it7ls1134889obb.27.gmail; Sat, 09 Nov
 2013 10:01:38 -0800 (PST)
X-Received: by 10.60.116.230 with SMTP id jz6mr17280381oeb.21.1384020098936;
        Sat, 09 Nov 2013 10:01:38 -0800 (PST)
Original-Received: from mail-ob0-x22b.google.com (mail-ob0-x22b.google.com [2607:f8b0:4003:c01::22b])
        by mx.google.com with ESMTPS id f9si7098844obv.10.2013.11.09.10.01.38
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 09 Nov 2013 10:01:38 -0800 (PST)
Received-SPF: pass (google.com: domain of billy.oneal@gmail.com designates 2607:f8b0:4003:c01::22b as permitted sender) client-ip=2607:f8b0:4003:c01::22b;
Original-Received: by mail-ob0-f171.google.com with SMTP id gq1so2770674obb.16
        for <std-proposals@isocpp.org>; Sat, 09 Nov 2013 10:01:38 -0800 (PST)
X-Received: by 10.182.166.40 with SMTP id zd8mr11245059obb.25.1384020098671;
 Sat, 09 Nov 2013 10:01:38 -0800 (PST)
Original-Received: by 10.182.87.37 with HTTP; Sat, 9 Nov 2013 10:00:58 -0800 (PST)
In-Reply-To: <CAKQj7N6ofpADmHuo-xzVV9KgYwjSVyTVCUy8RDwHynkOrfJf2A@mail.gmail.com>
X-Original-Sender: billy.oneal@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of billy.oneal@gmail.com designates 2607:f8b0:4003:c01::22b as
 permitted sender) smtp.mail=billy.oneal@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=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:7653
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7653>

--e89a8ff1ce0257ee5d04eac24a1f
Content-Type: text/plain; charset=ISO-8859-1

I for one am strongly opposed to removing size. However I can answer some
of these questions:

> How std::list<T>::size() makes most of the operation slower? I mean i did
not get how a method (like inline size() )of the class can affect the other
operation.

It forces the std::list implementation to modify the size value in mutating
operations.

>Again i did not understand how size() can impact the performance of
splice() method in this std::list<T>

Splice between distinct lists can be O(1), but must be O(n) in the standard
because the number of elements spliced has to be counted to update size().

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Sat, Nov 9, 2013 at 8:56 AM, MANTOSH KUMAR <mantosh4u@gmail.com> wrote:

> Hi,
>
> Frankly Speaking i also did not understand your points regarding the
> removing the std::list<T>::size() method from the standard.
>
> However here is my opinion on your points:
>
>
> 1. It makes most of the operations of std::list slower.
> How std::list<T>::size() makes most of the operation slower? I mean i did
> not get how a method (like inline size() )of the class can affect the other
> operation.
>
> 2. std::forward_list don't have this method. This makes people
> very confused
> size() is not defined for this container class because purpose of
> std::forward_list is different and it should be used for very small or
> empty situation. And to optimize and to save one extra word of size of
> object of this class, it only store a single base pointer.
>
> 3.the method splice() becomes much slower.
> Again i did not understand how size() can impact the performance of
> splice() method in this std::list<T>
>
>
> 4.We know our library couldn't make people very confused. That was why we
> didn't define the operator[] in the std::list<>;
> operator[] is not defined for std::list<T> not because of confusion and
> some other reason. Its not there because its not natural for std::list<T>
> and if someone would need this operator[], it would be terribly slow as
> operator[] is natural for random iterator(std::vector<T>).
>
>
>
> 5.The function of this method can be easily implied by programmers
> themselves. We know this function had been defined clearly in cpp11, but in
> the cpp98, its time-complexity is not defined clearly. For this reason, in
> the past we almost didn't use it. So  I think this change won't make so
> many codes invalid.
>
> If you are talking about the std::list<T>::size() time-complexity then i
> think its inline function and even it do not require the cost of a simple
> function call.
>
>
> I agree with the Daniel comment that its there in the standard since the
> inspection of STL library in C++. So no way it should be removed from the
> standard.
>
>
> Alexander Stepenov and Bjrane both advocate to use std::vector<T> instead
> of any other container unless you have very solid reason to do it
> otherwise. May be you should start thinking to use the std::vector<T> and
> should measure the performance of your program.
>
> Thanks
> Mantosh Kumar
>
>
>
>
> On Sat, Nov 9, 2013 at 10:03 PM, <euloanty@live.com> wrote:
>
>> 1.It makes most of the operations of std::list slower;
>> 2.std::forward_list don't have this method. This makes people
>> very confused.
>> 3.the method splice() becomes much slower.
>> 4.We know our library couldn't make people very confused. That was why we
>> didn't define the operator[] in the std::list<>;
>> 5.The function of this method can be easily implied by programmers
>> themselves. We know this function had been defined clearly in cpp11, but in
>> the cpp98, its time-complexity is not defined clearly. For this reason, in
>> the past we almost didn't use it. So  I think this change won't make so
>> many codes invalid.
>>
>> --
>>
>> ---
>> 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/.
>

-- 

--- 
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/.

--e89a8ff1ce0257ee5d04eac24a1f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I for one am strongly opposed to removing size. Howev=
er I can answer some of these questions:</div><div>=A0</div><div>&gt; How s=
td::list&lt;T&gt;::size() makes most of the operation slower? I mean i did =
not get how a method (like inline size() )of the class can affect the other=
 operation.</div>

<div>=A0</div><div>It forces the std::list implementation to modify the siz=
e value in mutating operations.</div><div>=A0</div><div>&gt;Again i did not=
 understand how size() can impact the performance of splice() method in thi=
s std::list&lt;T&gt;</div>

<div>=A0</div><div>Splice between distinct lists can be O(1), but must be O=
(n) in the standard because the number of elements spliced has to be counte=
d to update size().</div></div><div class=3D"gmail_extra"><br clear=3D"all"=
>
<div>
<div dir=3D"ltr"><div>Billy O&#39;Neal</div><div><a href=3D"https://bitbuck=
et.org/BillyONeal/" target=3D"_blank">https://github.com/BillyONeal/</a></d=
iv><div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=
=3D"_blank">http://stackoverflow.com/users/82320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Sat, Nov 9, 2013 at 8:56 AM, MANTOSH =
KUMAR <span dir=3D"ltr">&lt;<a href=3D"mailto:mantosh4u@gmail.com" target=
=3D"_blank">mantosh4u@gmail.com</a>&gt;</span> wrote:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">

<div dir=3D"ltr"><div><div><div><div>Hi, <br><br></div><div>Frankly Speakin=
g i also did not understand your points regarding the removing the std::lis=
t&lt;T&gt;::size() method from the standard.<br><br></div><div>However here=
 is my opinion on your points:<br>



<br></div><div><br>1. It makes most of the operations of=A0std::list slower=
..<br></div>How std::list&lt;T&gt;::size() makes most of the operation slowe=
r? I mean i did not get how a method (like inline size() )of the class can =
affect the other operation.<br>



<br></div>2. std::forward_list don&#39;t have this method. This makes peopl=
e very=A0confused<br></div>size() is not defined for this container class b=
ecause purpose of std::forward_list is different and it should be used for =
very small or empty situation. And to optimize and to save one extra word o=
f size of object of this class, it only store a single base pointer. <br>

<div class=3D"im">

<br>3.the method=A0splice() becomes much slower.<br></div></div>Again i did=
 not understand how size() can impact the performance of splice() method in=
 this std::list&lt;T&gt;<div class=3D"im"><br><br><div>4.We know our librar=
y couldn&#39;t make people very confused. That was=A0why we didn&#39;t defi=
ne the operator[] in the std::list&lt;&gt;;<br>



</div></div><div>operator[] is not defined for std::list&lt;T&gt; not becau=
se of confusion and some other reason. Its not there because its not natura=
l for std::list&lt;T&gt; and if someone would need this operator[], it woul=
d be terribly slow as operator[] is natural for random iterator(std::vector=
&lt;T&gt;).<br>



<br></div><div class=3D"im"><div><br><br></div>5.The
 function of this method can=A0be easily implied by programmers=20
themselves. We know this function had been defined clearly=A0in cpp11,=A0bu=
t
 in the cpp98, its time-complexity is not defined clearly. For this=20
reason,=A0in the past we=A0almost didn&#39;t=A0use it. So =A0I think this c=
hange=20
won&#39;t make so many codes invalid.<br><br></div><div>If you are talking =
about the std::list&lt;T&gt;::size() time-complexity then i think its inlin=
e function and even it do not require the cost of a simple function call.<b=
r>



<br><br></div><div>I agree with the Daniel comment that its there in the st=
andard since the inspection of STL library in C++. So no way it should be r=
emoved from the standard. <br><br><br></div><div>Alexander Stepenov and Bjr=
ane both advocate to use std::vector&lt;T&gt; instead of any other containe=
r unless you have very solid reason to do it otherwise. May be you should s=
tart thinking to use the std::vector&lt;T&gt; and should measure the perfor=
mance of your program.<br>



<br></div><div>Thanks<span class=3D"HOEnZb"><font color=3D"#888888"><br></f=
ont></span></div><span class=3D"HOEnZb"><font color=3D"#888888"><div>Mantos=
h Kumar<br></div></font></span><div><div class=3D"h5"><div><br><br><br></di=
v><div class=3D"gmail_extra">

=A0<br><div class=3D"gmail_quote">On Sat, Nov 9, 2013 at 10:03 PM,  <span d=
ir=3D"ltr">&lt;<a href=3D"mailto:euloanty@live.com" target=3D"_blank">euloa=
nty@live.com</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding=
-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-l=
eft-style:solid"><div dir=3D"ltr"><div>1.It makes most of the operations of=
=A0std::list slower;</div>

<div>2.std::forward_list don&#39;t have this method. This makes people very=
=A0confused.</div>

<div>3.the method=A0splice() becomes much slower.</div><div>4.We know our l=
ibrary couldn&#39;t make people very confused. That was=A0why we didn&#39;t=
 define the operator[] in the std::list&lt;&gt;;</div><div>5.The function o=
f this method can=A0be easily implied by programmers themselves. We know th=
is function had been defined clearly=A0in cpp11,=A0but in the cpp98, its ti=
me-complexity is not defined clearly. For this reason,=A0in the past we=A0a=
lmost didn&#39;t=A0use it. So =A0I think this change won&#39;t make so many=
 codes invalid.<br>



</div></div><div><div>

<p></p>

-- <br>
=A0<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" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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></div></div><div class=3D"HO=
EnZb"><div class=3D"h5">

<p></p>

-- <br>
=A0<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" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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>

<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 />

--e89a8ff1ce0257ee5d04eac24a1f--

.
