www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Containers I'd like to see in std.containers

reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
There are some simple containers I'd like to see in std.containers:

- a priority queue
- a heap
- a stack, a queue
- a set

Do people here also consider them as containers and useful ones in a standard
library?

  Philippe
May 30 2010
next sibling parent "Simen kjaeraas" <simen.kjaras gmail.com> writes:
Philippe Sigaud <philippe.sigaud gmail.com> wrote:

 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap
 - a stack, a queue
 - a set

 Do people here also consider them as containers and useful ones in a  
 standard
 library?

Absolutely. -- Simen
May 30 2010
prev sibling next sibling parent reply Rainer Deyke <rainerd eldwood.com> writes:
On 5/30/2010 15:53, Philippe Sigaud wrote:
 There are some simple containers I'd like to see in std.containers:
 
 - a priority queue
 - a heap
 - a stack, a queue
 - a set

Any container that supports pushing and popping on one end can be used as a stack. Any container that supports pushing on one end and popping on the other can be used as a queue. I don't think either of these need their own container type. The others, sure. -- Rainer Deyke - rainerd eldwood.com
May 30 2010
next sibling parent Marianne Gagnon <auria.mg gmail.com> writes:
Rainer Deyke Wrote:

 On 5/30/2010 15:53, Philippe Sigaud wrote:
 There are some simple containers I'd like to see in std.containers:
 
 - a priority queue
 - a heap
 - a stack, a queue
 - a set

Any container that supports pushing and popping on one end can be used as a stack. Any container that supports pushing on one end and popping on the other can be used as a queue. I don't think either of these need their own container type.

in the C++ STL, queues and stacks are only adapters to another container I believe; but I still think it's useful to have them. Stack!int m_ints; seems clearer to me than : /** this is a stack */ Vector!int m_ints;
May 30 2010
prev sibling next sibling parent reply "Simen kjaeraas" <simen.kjaras gmail.com> writes:
Rainer Deyke <rainerd eldwood.com> wrote:

 Any container that supports pushing and popping on one end can be used
 as a stack.  Any container that supports pushing on one end and popping
 on the other can be used as a queue.  I don't think either of these need
 their own container type.

There are other concerns than simply what works. First of all is readability - having containers called queue and stack makes code easier to understand, even if this is done with a simple alias. There might also be a concern about efficiency, as there is a difference in how fast different containers can push and pop. -- Simen
May 30 2010
next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 05/30/2010 05:32 PM, Simen kjaeraas wrote:
 Rainer Deyke <rainerd eldwood.com> wrote:

 Any container that supports pushing and popping on one end can be used
 as a stack. Any container that supports pushing on one end and popping
 on the other can be used as a queue. I don't think either of these need
 their own container type.

There are other concerns than simply what works. First of all is readability - having containers called queue and stack makes code easier to understand, even if this is done with a simple alias. There might also be a concern about efficiency, as there is a difference in how fast different containers can push and pop.

std.container is designed to provide operations only within strict complexity limits. So if something offers insertFront and removeFront or insertBack and removeBack, it should be usable as a stack. Andrei
May 30 2010
prev sibling next sibling parent Justin Spahr-Summers <Justin.SpahrSummers gmail.com> writes:
On Mon, 31 May 2010 00:32:44 +0200, Simen kjaeraas 
<simen.kjaras gmail.com> wrote:
 
 Rainer Deyke <rainerd eldwood.com> wrote:
 
 Any container that supports pushing and popping on one end can be used
 as a stack.  Any container that supports pushing on one end and popping
 on the other can be used as a queue.  I don't think either of these need
 their own container type.

There are other concerns than simply what works. First of all is readability - having containers called queue and stack makes code easier to understand, even if this is done with a simple alias. There might also be a concern about efficiency, as there is a difference in how fast different containers can push and pop.

This strikes me as a reason to actually not provide such aliases. Even for stacks and queues, there are tradeoffs involved in the selection of containers. For instance, vectors and linked lists can both service for a stack implementation, but they have rather different performance and memory characteristics. Similarly for deques implemented with arrays or doubly-linked lists.
May 30 2010
prev sibling next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Philippe Sigaud:
 Yeah, particularly if having both stack and queue just costs one alias. I

example) as stacks and queues, but sometimes I just want to have a stack.

And in some situations it's better to have stacks and queues implemented with a deque (for example a dynamic array of pointers to short fixed-size arrays, where all arrays but the first and last one are full) instead of just a dynamic array. Later some kind of cache-conscious B+-something tree can be useful ^_^ The implementation is not much harder than the Red-black trees, etc, but they can be better for small keys, because they use CPU cache lines better. Bye, bearophile
May 31 2010
prev sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 05/31/2010 02:36 PM, Philippe Sigaud wrote:
 Simen & Marianne too:


     There are other concerns than simply what works. First of all is
     readability - having containers called queue and stack makes code easier
     to understand, even if this is done with a simple alias.
     There might also be a concern about efficiency, as there is a difference
     in how fast different containers can push and pop.

     --
     Simen


 Yeah, particularly if having both stack and queue just costs one alias.
 I mean, it's a standard library. I know I can use built-in arrays (for
 example) as stacks and queues, but sometimes I just want to have a stack.

My opinion in the matter is that it's good to have stacks and queues just because in general sometimes it's better to have a more restricted interface. Andrei
May 31 2010
prev sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--0016364c7745f9b74c0487e8f918
Content-Type: text/plain; charset=ISO-8859-1

Simen & Marianne too:

 There are other concerns than simply what works. First of all is
 readability - having containers called queue and stack makes code easier
 to understand, even if this is done with a simple alias.
 There might also be a concern about efficiency, as there is a difference
 in how fast different containers can push and pop.

 --
 Simen

Yeah, particularly if having both stack and queue just costs one alias. I mean, it's a standard library. I know I can use built-in arrays (for example) as stacks and queues, but sometimes I just want to have a stack. Initially in my mind, that was just to make some graph algorithms clearer. Philippe --0016364c7745f9b74c0487e8f918 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br>Simen &amp; Marianne too:<br><div class=3D"gmail_quote"><blockquote cla= ss=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px sol= id rgb(204, 204, 204); padding-left: 1ex;"><div class=3D"im"><br></div> There are other concerns than simply what works. First of all is<br> readability - having containers called queue and stack makes code easier<br=

There might also be a concern about efficiency, as there is a difference<br=

<br> -- <br><font color=3D"#888888"> Simen<br> </font></blockquote></div><br>Yeah, particularly if having both stack and q= ueue just costs one alias. I mean, it&#39;s a standard library. I know I ca= n use built-in arrays (for example) as stacks and queues, but sometimes I j= ust want to have a stack.<br> <br>Initially in my mind, that was just to make some graph algorithms clear= er.<br><br><br>=A0 Philippe<br> --0016364c7745f9b74c0487e8f918--
May 31 2010
prev sibling next sibling parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 05/30/2010 04:53 PM, Philippe Sigaud wrote:
 There are some simple containers I'd like to see in std.containers:

 - a priority queue

(incf vote) It seems like I'm always writing priority queue implementations whose elements get mutated at weird times and need to be resorted.
 - a heap
 - a stack, a queue

alias + doubly linked list
 - a set

want
 Do people here also consider them as containers and useful ones in a standard
 library?

    Philippe

May 30 2010
prev sibling next sibling parent reply Jonathan M Davis <jmdavisProg gmail.com> writes:
Philippe Sigaud wrote:

 There are some simple containers I'd like to see in std.containers:
 
 - a priority queue
 - a heap
 - a stack, a queue
 - a set
 
 Do people here also consider them as containers and useful ones in a
 standard library?
 
   Philippe

A sorted map in addition to a hash map would be good, and for a set, both a sorted and a hash variety woud be good. And of course, multisets and multimaps would be useful too. We also lack a doubly-linked list. I do agree with others that a normal stack and queue are either unnecessary or that they should be achieved via aliasing or some other thin wrapper. Creating a whole new container just for a name seems a bit silly and creates more code to maintain. - Jonathan M Davis
May 30 2010
parent reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 05/30/2010 06:25 PM, Jonathan M Davis wrote:
 Philippe Sigaud wrote:

 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap
 - a stack, a queue
 - a set

 Do people here also consider them as containers and useful ones in a
 standard library?

    Philippe

A sorted map in addition to a hash map would be good, and for a set, both a sorted and a hash variety woud be good. And of course, multisets and multimaps would be useful too. We also lack a doubly-linked list.

Maybe an ordered map, i.e. keeps track of order of insertion? I think I saw this in python once. Looked handy.
 I do agree with others that a normal stack and queue are either unnecessary
 or that they should be achieved via aliasing or some other thin wrapper.
 Creating a whole new container just for a name seems a bit silly and creates
 more code to maintain.

 - Jonathan M Davis

May 30 2010
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 05/30/2010 07:10 PM, Ellery Newcomer wrote:
 On 05/30/2010 06:25 PM, Jonathan M Davis wrote:
 Philippe Sigaud wrote:

 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap
 - a stack, a queue
 - a set

 Do people here also consider them as containers and useful ones in a
 standard library?

 Philippe

A sorted map in addition to a hash map would be good, and for a set, both a sorted and a hash variety woud be good. And of course, multisets and multimaps would be useful too. We also lack a doubly-linked list.

Maybe an ordered map, i.e. keeps track of order of insertion? I think I saw this in python once. Looked handy.

I'm thinking of a slightly different course for std.container. Instead of defining an OrderedMap structure that doesn't specify its implementation, std.container will define _explicit_ consecrated data structures, such as BinaryTree and RedBlackTree (Steve Schveighoffer graciously contributed his R-B tree implementation). Later on, we might define a set of generic aliases for typical container choices, but I want std.container to actually reflect the interesting personalities and tradeoffs that data structures have. Andrei
May 30 2010
parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 05/30/2010 07:41 PM, Andrei Alexandrescu wrote:
 On 05/30/2010 07:10 PM, Ellery Newcomer wrote:
 On 05/30/2010 06:25 PM, Jonathan M Davis wrote:
 Philippe Sigaud wrote:

 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap
 - a stack, a queue
 - a set

 Do people here also consider them as containers and useful ones in a
 standard library?

 Philippe

A sorted map in addition to a hash map would be good, and for a set, both a sorted and a hash variety woud be good. And of course, multisets and multimaps would be useful too. We also lack a doubly-linked list.

Maybe an ordered map, i.e. keeps track of order of insertion? I think I saw this in python once. Looked handy.

I'm thinking of a slightly different course for std.container. Instead of defining an OrderedMap structure that doesn't specify its implementation, std.container will define _explicit_ consecrated data structures, such as BinaryTree and RedBlackTree (Steve Schveighoffer graciously contributed his R-B tree implementation). Later on, we might define a set of generic aliases for typical container choices, but I want std.container to actually reflect the interesting personalities and tradeoffs that data structures have. Andrei

My bad. alias RedBlackTreeWithDoublyLinkedListFieldsInRBNodeAndMaraschinoCherryOnTop OrderedMap; Disregarding implementation, do you think this one would be useful enough to merit inclusion?
May 30 2010
prev sibling next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 05/30/2010 04:53 PM, Philippe Sigaud wrote:
 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap

What's the difference between the two?
 - a stack, a queue

These are adaptors over other containers, I agree they should be in.
 - a set

Yah, though I want std.container to focus on implementation, not policy. Andrei
May 30 2010
next sibling parent reply Johan Granberg <lijat.meREM OVEgmail.com> writes:
Philippe Sigaud wrote:

 On Mon, May 31, 2010 at 01:56, Andrei Alexandrescu <
 SeeWebsiteForEmail erdani.org> wrote:
 
 On 05/30/2010 04:53 PM, Philippe Sigaud wrote:

 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap

What's the difference between the two?

Looking at some old code of mine, not much. Once you have a BinaryHeap, a PriorityQueue!(Payload,Priority) is just a BinaryHeap!(Tuple!(Payload, Priority)) with a sorter acting on the tuple's second field and front() (or whatever it's called for containers) returning the first field. And, of course, nice creating functions. So, heap is the basis, priority queue is just a nice wrapper. But I want nice wrappers! They are easy to code, and gives joe phobos what he wants.
  - a stack, a queue

These are adaptors over other containers, I agree they should be in.

Yes, an adaptor with a default implementation. Do you consider built-in arrays (not slices) to be containers?
  - a set

Yah, though I want std.container to focus on implementation, not policy.

Please, a set, please, a set! I mean, where would you put it otherwise? Philippe

I also think a set would be highly usefull, and when defining it pleas don't let the set operations (union,intersection,maybe complement) be defined. I recently was writing some c++ code and got a nasty preformance hit from not finding a fast set union operation.
Jun 06 2010
parent Jonathan M Davis <jmdavisProg gmail.com> writes:
Steven Schveighoffer wrote:

 On Sun, 06 Jun 2010 14:48:27 -0400, Johan Granberg
 <lijat.meREM ovegmail.com> wrote:
 
 
 I also think a set would be highly usefull, and when defining it pleas
 don't
 let the set operations (union,intersection,maybe complement) be defined.
 I
 recently was writing some c++ code and got a nasty preformance hit from
 not
 finding a fast set union operation.

I don't understand this. What better place to put set operations such as intersection and union besides the implementation of the set itself?

I think that the complaint is that they _weren't_ included in the implementation itself, and he hopes that D's implementation _does_ include them. - Jonathan M Davis
Jun 07 2010
prev sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Sun, 06 Jun 2010 14:48:27 -0400, Johan Granberg  
<lijat.meREM ovegmail.com> wrote:


 I also think a set would be highly usefull, and when defining it pleas  
 don't
 let the set operations (union,intersection,maybe complement) be defined.  
 I
 recently was writing some c++ code and got a nasty preformance hit from  
 not
 finding a fast set union operation.

I don't understand this. What better place to put set operations such as intersection and union besides the implementation of the set itself? For example, dcollections includes these operations (union (add) and complement (remove) are essential anyways, intersection is the odd duck) as the quickest possible implementation O(n * lg(n)). -Steve
Jun 07 2010
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--0016e65b5f50ab1b9d0487e90416
Content-Type: text/plain; charset=ISO-8859-1

On Mon, May 31, 2010 at 00:47, Ellery Newcomer
<ellery-newcomer utulsa.edu>wrote:

 On 05/30/2010 04:53 PM, Philippe Sigaud wrote:

 There are some simple containers I'd like to see in std.containers:

 - a priority queue

(incf vote) It seems like I'm always writing priority queue implementations whose elements get mutated at weird times and need to be resorted.

Me too. Once again, it's a standard libray, it should offer the things anyone will code in its first three months in D. I know I did :-) If Andrei wants std.containers to be containers and this list contains _things_ that are not containers, then by all mean Phobos should have a std.usefulThingiesToPutThingsIn
  - a heap
 - a stack, a queue

alias + doubly linked list - a set

want

such. Philippe --0016e65b5f50ab1b9d0487e90416 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Mon, May 31, 2010 at 00:47, Ellery Ne= wcomer <span dir=3D"ltr">&lt;<a href=3D"mailto:ellery-newcomer utulsa.edu">= ellery-newcomer utulsa.edu</a>&gt;</span> wrote:<br><blockquote class=3D"gm= ail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(2= 04, 204, 204); padding-left: 1ex;"> <div class=3D"im">On 05/30/2010 04:53 PM, Philippe Sigaud wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> There are some simple containers I&#39;d like to see in std.containers:<br> <br> - a priority queue<br> </blockquote> <br></div> (incf vote)<br> <br> It seems like I&#39;m always writing priority queue implementations whose e= lements get mutated at weird times and need to be resorted.</blockquote><di= v><br>Me too. Once again, it&#39;s a standard libray, it should offer the t= hings anyone will code in its first three months in D.<br> I know I did :-)<br><br>If Andrei wants std.containers to be containers and= this list contains _things_ that are not containers, then by all mean Phob= os should have a std.usefulThingiesToPutThingsIn<br><br><br><br>=A0</div> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class=3D"im"=
<br>

<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> - a heap<br> - a stack, a queue<br> </blockquote> <br></div> alias + doubly linked list<br> <br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> - a set<br> </blockquote> <br> want<div><div></div><div class=3D"h5"><br></div></div></blockquote><div><br=
I always end up using a bool[T] as a set, every feeling like I&#39;m cheat=

--0016e65b5f50ab1b9d0487e90416--
May 31 2010
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--0016e65b60f207b1d40487e91fbe
Content-Type: text/plain; charset=ISO-8859-1

On Mon, May 31, 2010 at 01:56, Andrei Alexandrescu <
SeeWebsiteForEmail erdani.org> wrote:

 On 05/30/2010 04:53 PM, Philippe Sigaud wrote:

 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap

What's the difference between the two?

Looking at some old code of mine, not much. Once you have a BinaryHeap, a PriorityQueue!(Payload,Priority) is just a BinaryHeap!(Tuple!(Payload, Priority)) with a sorter acting on the tuple's second field and front() (or whatever it's called for containers) returning the first field. And, of course, nice creating functions. So, heap is the basis, priority queue is just a nice wrapper. But I want nice wrappers! They are easy to code, and gives joe phobos what he wants.
  - a stack, a queue

These are adaptors over other containers, I agree they should be in.

Yes, an adaptor with a default implementation. Do you consider built-in arrays (not slices) to be containers?
  - a set

Yah, though I want std.container to focus on implementation, not policy.

Please, a set, please, a set! I mean, where would you put it otherwise? Philippe --0016e65b60f207b1d40487e91fbe Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Mon, May 31, 2010 at 01:56, Andrei Al= exandrescu <span dir=3D"ltr">&lt;<a href=3D"mailto:SeeWebsiteForEmail erdan= i.org">SeeWebsiteForEmail erdani.org</a>&gt;</span> wrote:<br><blockquote c= lass=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px s= olid rgb(204, 204, 204); padding-left: 1ex;"> <div class=3D"im">On 05/30/2010 04:53 PM, Philippe Sigaud wrote:<br> </div><div class=3D"im"><blockquote class=3D"gmail_quote" style=3D"margin: = 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left:= 1ex;"> There are some simple containers I&#39;d like to see in std.containers:<br> <br> - a priority queue<br> - a heap<br> </blockquote> <br></div> What&#39;s the difference between the two?<br></blockquote><div><br>Looking= at some old code of mine, not much. Once you have a BinaryHeap, a Priority= Queue!(Payload,Priority) is just a BinaryHeap!(Tuple!(Payload, Priority))<b= r> with a sorter acting on the tuple&#39;s second field and front() (or whatev= er it&#39;s called for containers) returning the first field.<br>And, of co= urse, nice creating functions.<br><br>So, heap is the basis, priority queue= is just a nice wrapper. But I want nice wrappers! They are easy to code, a= nd gives joe phobos what he wants.<br> <br>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt= 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> <br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> - a stack, a queue<br> </blockquote> <br> These are adaptors over other containers, I agree they should be in.<br></b= lockquote><div><br>Yes, an adaptor with a default implementation. Do you co= nsider built-in arrays (not slices) to be containers? <br><br>=A0</div><blo= ckquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-le= ft: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> <br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> - a set<br> </blockquote> <br> Yah, though I want std.container to focus on implementation, not policy.<br=
</blockquote><div><br>Please, a set, please, a set!<br>I mean, where would=

--0016e65b60f207b1d40487e91fbe--
May 31 2010
prev sibling next sibling parent reply Mihail Strashun <m.strashun gmail.com> writes:
May be my question will be a bit naive, but what is about 
boost::multi_index approach? I find it brilliant for dividing container 
implementation from various container interfaces - things you guys are 
arguing here about a bit.

On 05/31/2010 12:53 AM, Philippe Sigaud wrote:
 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap
 - a stack, a queue
 - a set

 Do people here also consider them as containers and useful ones in a standard
 library?

    Philippe

May 31 2010
parent Mihail Strashun <m.strashun gmail.com> writes:
On 06/01/2010 10:48 PM, Philippe Sigaud wrote:
 On Mon, May 31, 2010 at 22:27, Mihail Strashun <m.strashun gmail.com
 <mailto:m.strashun gmail.com>> wrote:

     May be my question will be a bit naive, but what is about
     boost::multi_index approach? I find it brilliant for dividing
     container implementation from various container interfaces - things
     you guys are arguing here about a bit.


 My even more naive answer is that I neved had occasion to use it, as I
 think I quit C++ before this existed in Boost (but I may be wrong). I
 read the docs for multi-index once or twice, though. Did you use it
 recently?

Yep, used it about a half an year ago last time. For example, for defining nice OrderedMap with only a pair lines of code :) Liked idea a lot and thought that similar stuff in D2 could be even better, getting rid of C++ template syntax.
 Hey, I was re-reading Boost::MPL, Fusion and Graph recently and was
 thinking that it's be quite easier to do that in D.

I think same, don't no D so good yet, though.
 Interestingly, on Boost 1.43 (may 6th):


       Major Updates

     * Range <http://www.boost.org/libs/range/index.html>: Boost.Range
       has undergone extensive updates that it include all of the
       features from the recently reviewed Boost.RangeEx, from Neil Groves.
           o Range-based version of the full STL iterator based algorithms.
           o Range adaptors which can be combined with range-based
             algorithms for unprecedented expressiveness and efficiency.
           o New functions: irange, istream_range, join, combine.


 http://www.boost.org/doc/libs/1_43_0/libs/range/doc/html/index.html

 Man, I didn't know they had it.

Boost::Range is hanging there for quite a long time - more than 5 years, AFAIK.
Jun 01 2010
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--0016e6da934ac5623b0487fd41c6
Content-Type: text/plain; charset=ISO-8859-1

On Mon, May 31, 2010 at 22:27, Mihail Strashun <m.strashun gmail.com> wrote:

 May be my question will be a bit naive, but what is about
 boost::multi_index approach? I find it brilliant for dividing container
 implementation from various container interfaces - things you guys are
 arguing here about a bit.

I quit C++ before this existed in Boost (but I may be wrong). I read the docs for multi-index once or twice, though. Did you use it recently? Hey, I was re-reading Boost::MPL, Fusion and Graph recently and was thinking that it's be quite easier to do that in D. Interestingly, on Boost 1.43 (may 6th): Major Updates - Range <http://www.boost.org/libs/range/index.html>: Boost.Range has undergone extensive updates that it include all of the features from the recently reviewed Boost.RangeEx, from Neil Groves. - Range-based version of the full STL iterator based algorithms. - Range adaptors which can be combined with range-based algorithms for unprecedented expressiveness and efficiency. - New functions: irange, istream_range, join, combine. http://www.boost.org/doc/libs/1_43_0/libs/range/doc/html/index.html Man, I didn't know they had it. --0016e6da934ac5623b0487fd41c6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><div class=3D"gmail_quote">On Mon, May 31, 2010 at 22:27, Mihail Strash= un <span dir=3D"ltr">&lt;<a href=3D"mailto:m.strashun gmail.com" target=3D"= _blank">m.strashun gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"= gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb= (204, 204, 204); padding-left: 1ex;"> May be my question will be a bit naive, but what is about boost::multi_inde= x approach? I find it brilliant for dividing container implementation from = various container interfaces - things you guys are arguing here about a bit= .<div> <div></div><br></div></blockquote><div><br>My even more naive answer is tha= t I neved had occasion to use it, as I think I quit C++ before this existed= in Boost (but I may be wrong). I read the docs for multi-index once or twi= ce, though. Did you use it recently?<br> <br>Hey, I was re-reading Boost::MPL, Fusion and Graph recently and was thi= nking that it&#39;s be quite easier to do that in D.<br><br>Interestingly, = on Boost 1.43 (may 6th):<br><br><div id=3D"version_1_43_0.major_updates"> <h3><span class=3D"link">Major Updates</span></h3> <ul><li> <span class=3D"library"><a href=3D"http://www.boost.org/libs/range/= index.html">Range</a>:</span> Boost.Range has undergone extensive updates that it include all of the features=20 from the recently reviewed Boost.RangeEx, from Neil Groves. <ul><li> Range-based version of the full STL iterator based=20 algorithms. </li><li> Range adaptors which can be combined with range-based=20 algorithms for unprecedented expressiveness and efficiency. </li><li> New functions: irange, istream_range, join, combine. </li></ul></li></ul><br><a href=3D"http://www.boost.org/doc/libs/= 1_43_0/libs/range/doc/html/index.html">http://www.boost.org/doc/libs/1_43_0= /libs/range/doc/html/index.html</a><br> </div><br>Man, I didn&#39;t know they had it.<br></div></div> --0016e6da934ac5623b0487fd41c6--
Jun 01 2010
prev sibling next sibling parent dennis luehring <dl.soluz gmx.net> writes:
Am 30.05.2010 23:53, schrieb Philippe Sigaud:
 There are some simple containers I'd like to see in std.containers:

 - a priority queue
 - a heap
 - a stack, a queue
 - a set

 Do people here also consider them as containers and useful ones in a standard
 library?

    Philippe

and a range based tree (something like http://tree.phi-sci.com/) and what about graphs?
Jun 01 2010
prev sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--0016e6da934a25f8bf048813dfce
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Jun 2, 2010 at 08:27, dennis luehring <dl.soluz gmx.net> wrote:

 Am 30.05.2010 23:53, schrieb Philippe Sigaud:

  There are some simple containers I'd like to see in std.containers:
 - a priority queue
 - a heap
 - a stack, a queue
 - a set

 Do people here also consider them as containers and useful ones in a
 standard
 library?

   Philippe

and a range based tree (something like http://tree.phi-sci.com/) and what about graphs?

I gave it a try some times ago. Here are the current modules: http://www.dsource.org/projects/dranges/wiki (look into the tree and graph section and tell me what you think.) There is a basic tree and basic graph, some consideration on recursive ranges and a bunch of graph algorithms (dijkstra, spanning tree, meta-graph, strongly connected components, etc). Also, ways to project a tree or graph into a linear range, by depth-first or breadth-first iteration. It's taken from an older project of mine,I will clean it up in the following weeks. Philippe --0016e6da934a25f8bf048813dfce Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Wed, Jun 2, 2010 at 08:27, dennis lue= hring <span dir=3D"ltr">&lt;<a href=3D"mailto:dl.soluz gmx.net">dl.soluz gm= x.net</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"m= argin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); paddin= g-left: 1ex;"> Am 30.05.2010 23:53, schrieb Philippe Sigaud:<div><div></div><div class=3D"= h5"><br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> There are some simple containers I&#39;d like to see in std.containers:<br> <br> - a priority queue<br> - a heap<br> - a stack, a queue<br> - a set<br> <br> Do people here also consider them as containers and useful ones in a standa= rd<br> library?<br> <br> =A0 Philippe<br> </blockquote> <br></div></div> and a range based tree (something like <a href=3D"http://tree.phi-sci.com/"= target=3D"_blank">http://tree.phi-sci.com/</a>)<br> <br> and what about graphs?<br></blockquote><div><br><br>I gave it a try some ti= mes ago. Here are the current modules:<br><br><a href=3D"http://www.dsource= .org/projects/dranges/wiki">http://www.dsource.org/projects/dranges/wiki</a=
 <br>

think.)<br><br>There is a basic tree and basic graph, some consideration on= recursive ranges and a bunch of graph algorithms (dijkstra, spanning tree,= meta-graph, strongly connected components, etc). Also, ways to project a t= ree or graph into a linear range, by depth-first or breadth-first iteration= .<br> It&#39;s taken from an older project of mine,I will clean it up in the foll= owing weeks.<br><br>Philippe<br><br> --0016e6da934a25f8bf048813dfce--
Jun 02 2010