Re: get number of items in DList

2014-07-15 Thread pgtkda via Digitalmars-d-learn
On Friday, 11 July 2014 at 14:48:26 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Fri, Jul 11, 2014 at 10:23:58AM -0300, Ary Borenszweig via Digitalmars-d-learn wrote: On 7/11/14, 4:46 AM, bearophile wrote: pgtkda: How can i get the number of items which are currently hold in a DList?

Re: get number of items in DList

2014-07-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Fri, 11 Jul 2014 07:46:37 -0700 H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Fri, Jul 11, 2014 at 10:23:58AM -0300, Ary Borenszweig via Digitalmars-d-learn wrote: On 7/11/14, 4:46 AM, bearophile wrote: pgtkda: How can i get the number of items which

get number of items in DList

2014-07-11 Thread pgtkda via Digitalmars-d-learn
How can i get the number of items which are currently hold in a DList?

Re: get number of items in DList

2014-07-11 Thread bearophile via Digitalmars-d-learn
pgtkda: How can i get the number of items which are currently hold in a DList? Try (walkLength is from std.range): mydList[].walkLength Bye, bearophile

Re: get number of items in DList

2014-07-11 Thread Ary Borenszweig via Digitalmars-d-learn
On 7/11/14, 4:46 AM, bearophile wrote: pgtkda: How can i get the number of items which are currently hold in a DList? Try (walkLength is from std.range): mydList[].walkLength Bye, bearophile So the doubly linked list doesn't know it's length? That seems a bit inefficient...

Re: get number of items in DList

2014-07-11 Thread bearophile via Digitalmars-d-learn
Ary Borenszweig: So the doubly linked list doesn't know it's length? That seems a bit inefficient... Have you tried to compile mydList.length or mydList[].length? If both don't compile, then you have to walk the items. Walking the items is not efficient, but: - Linked lists are very

Re: get number of items in DList

2014-07-11 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jul 11, 2014 at 10:23:58AM -0300, Ary Borenszweig via Digitalmars-d-learn wrote: On 7/11/14, 4:46 AM, bearophile wrote: pgtkda: How can i get the number of items which are currently hold in a DList? Try (walkLength is from std.range): mydList[].walkLength Bye, bearophile