220 7651 <CAKQj7N6ofpADmHuo-xzVV9KgYwjSVyTVCUy8RDwHynkOrfJf2A@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: MANTOSH KUMAR <mantosh4u@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 22:26:36 +0530
Lines: 201
Approved: news@gmane.org
Message-ID: <CAKQj7N6ofpADmHuo-xzVV9KgYwjSVyTVCUy8RDwHynkOrfJf2A@mail.gmail.com>
References: <9be1f793-a061-4193-8a91-eedc81fa703e@isocpp.org> <433a9ee1-0ae3-4af7-ad93-028e416075ad@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c3e47cf2726204eac162a6
X-Trace: ger.gmane.org 1384016213 13160 80.91.229.3 (9 Nov 2013 16:56:53 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 9 Nov 2013 16:56:53 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDVMFP64YYBRBWGS7GJQKGQEZ3LTQ3I@isocpp.org Sat Nov 09 17:56:59 2013
Return-path: <std-proposals+bncBDVMFP64YYBRBWGS7GJQKGQEZ3LTQ3I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f199.google.com ([209.85.214.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDVMFP64YYBRBWGS7GJQKGQEZ3LTQ3I@isocpp.org>)
	id 1VfBqE-00054s-Gh
	for gclcip-std-proposals@m.gmane.org; Sat, 09 Nov 2013 17:56:58 +0100
Original-Received: by mail-ob0-f199.google.com with SMTP id wm4sf8415300obc.2
        for <gclcip-std-proposals@m.gmane.org>; Sat, 09 Nov 2013 08:56:57 -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=k3oiYj+sdnQV2g550AJUJ02hJ2Byq3z+lAnRpsqaX+Q=;
        b=e4cRKJusY/SrGkcLB8X2rzPce39oUDrs4W3XMaLEe1wV2szNtS1Pfvwdi0BlM9St2S
         SYUUmJ2jpvZuScT3vy+RCakUyoCAyF8jnuRIQ1q4lqHGQYG+v4JmLlSBwSvOE9HqG5BS
         H6lA1R4LkiuHdkmbegEThn+F7tgr2iIlbLDz0c7rmMR4HS0SL0qtfqxcsWXJ/8ydaJUu
         fBSTg4gAzzqDKJu821YuCvPYs1m4ebFVxZYbcnLF9O0P3ZAtRF0X/T/XRgFMZaWCboZk
         ZvJjOb74jLkP4tUOaIproa9DOc/1KEVbbqxyAKFkzH+4P3WQZQYW79Kpoqb4wx2DC24O
         mg+Q==
X-Gm-Message-State: ALoCoQnMV82pmAytQUZxsdyvDt4bqcJ2HtXfSd0uCQqWR8vxzcGQQdHrwhA68lty2r7mXVkBUYpE
X-Received: by 10.182.66.137 with SMTP id f9mr6605358obt.3.1384016217560;
        Sat, 09 Nov 2013 08:56:57 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.107.69 with SMTP id ha5ls2047765qeb.87.gmail; Sat, 09 Nov
 2013 08:56:56 -0800 (PST)
X-Received: by 10.52.116.74 with SMTP id ju10mr14104628vdb.20.1384016216638;
        Sat, 09 Nov 2013 08:56:56 -0800 (PST)
Original-Received: from mail-ve0-x234.google.com (mail-ve0-x234.google.com [2607:f8b0:400c:c01::234])
        by mx.google.com with ESMTPS id ry8si6305599vcb.121.2013.11.09.08.56.56
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 09 Nov 2013 08:56:56 -0800 (PST)
Received-SPF: pass (google.com: domain of mantosh4u@gmail.com designates 2607:f8b0:400c:c01::234 as permitted sender) client-ip=2607:f8b0:400c:c01::234;
Original-Received: by mail-ve0-f180.google.com with SMTP id oy12so2285093veb.39
        for <std-proposals@isocpp.org>; Sat, 09 Nov 2013 08:56:56 -0800 (PST)
X-Received: by 10.220.11.7 with SMTP id r7mr16782346vcr.12.1384016216484; Sat,
 09 Nov 2013 08:56:56 -0800 (PST)
Original-Received: by 10.52.231.71 with HTTP; Sat, 9 Nov 2013 08:56:36 -0800 (PST)
In-Reply-To: <433a9ee1-0ae3-4af7-ad93-028e416075ad@isocpp.org>
X-Original-Sender: mantosh4u@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of mantosh4u@gmail.com designates 2607:f8b0:400c:c01::234 as permitted
 sender) smtp.mail=mantosh4u@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:7651
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7651>

--001a11c3e47cf2726204eac162a6
Content-Type: text/plain; charset=ISO-8859-1

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/.

--001a11c3e47cf2726204eac162a6
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<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>

<br>3.the method=A0splice() becomes much slower.<br></div>Again i did not u=
nderstand how size() can impact the performance of splice() method in this =
std::list&lt;T&gt;<br><br><div>4.We know our library couldn&#39;t make peop=
le very confused. That was=A0why we didn&#39;t define the operator[] in the=
 std::list&lt;&gt;;<br>

</div><div>operator[] is not defined for std::list&lt;T&gt; not because of =
confusion and some other reason. Its not there because its not natural for =
std::list&lt;T&gt; and if someone would need this operator[], it would be t=
erribly slow as operator[] is natural for random iterator(std::vector&lt;T&=
gt;).<br>

<br></div><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>If you are talking about =
the std::list&lt;T&gt;::size() time-complexity then i think its inline func=
tion and even it do not require the cost of a simple function call.<br>

<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<br></div><div>Mantosh Kumar<br></div><div><br><br><br=
></div><div class=3D"gmail_extra">=A0<br><div class=3D"gmail_quote">On Sat,=
 Nov 9, 2013 at 10:03 PM,  <span dir=3D"ltr">&lt;<a href=3D"mailto:euloanty=
@live.com" target=3D"_blank">euloanty@live.com</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><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 class=3D"HOEnZb"><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></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 />

--001a11c3e47cf2726204eac162a6--

.
