I've done that in C++ before using Boost.MultiIndex, and i saw a
post about a D port of that recently (I don't have the link to
hand though).
On Fri, 23 Mar 2012 23:48:51 +0100, Andrej Mitrovic wrote:
> Does someone have a map implementation that maintains the insertion
> order of the keys?
>
> E.g.:
>
> string[string] map;
> map["foo"] = "x";
> map["bar"] = "y";
>
> When iterating over map keys I want to visit "foo" first, then "bar
On Saturday, 24 March 2012 at 01:07:56 UTC, Jonathan M Davis
wrote:
On Friday, March 23, 2012 23:48:51 Andrej Mitrovic wrote:
Does someone have a map implementation that maintains the
insertion
order of the keys?
E.g.:
string[string] map;
map["foo"] = "x";
map["bar"] = "y";
When iterating ov
On 3/24/12, Andrej Mitrovic wrote:
> Correction, it's:
> template isValue(T)
> {
> enum bool isValue = is(typeof( { Value v; T t; v = t; } ))
> || is(typeof( { BaseElement!Value v; T t; v = t; } ))
> || is(BaseElement!Value == T);
> }
Last check not needed, so:
> template isValue(T)
>
On 3/24/12, Andrej Mitrovic wrote:
> static if (isArray!Value)
> {
> template isValue(T)
> {
>enum bool isValue = is(typeof( { Value v; T t; v = t; } )) ||
> is(BaseElement!Value == T);
> }
> }
Correction, it's:
template isValue(T)
{
enum bool isValue = is(typeof( { Value
On 3/24/12, Andrej Mitrovic wrote:
> On 3/23/12, Andrej Mitrovic wrote:
>> Does someone have a map implementation that maintains the insertion
>> order of the keys?
>
> Here's a sloppy implementation:
I forgot to make opIndex ref, but also the isValue check fails on
structs with alias this, it's
On Fri, Mar 23, 2012 at 06:33:54PM -0700, H. S. Teoh wrote:
> On Fri, Mar 23, 2012 at 06:07:42PM -0700, Jonathan M Davis wrote:
> > On Friday, March 23, 2012 23:48:51 Andrej Mitrovic wrote:
> > > Does someone have a map implementation that maintains the insertion
> > > order of the keys?
> > >
> >
On Fri, Mar 23, 2012 at 06:07:42PM -0700, Jonathan M Davis wrote:
> On Friday, March 23, 2012 23:48:51 Andrej Mitrovic wrote:
> > Does someone have a map implementation that maintains the insertion
> > order of the keys?
> >
> > E.g.:
> >
> > string[string] map;
> > map["foo"] = "x";
> > map["bar
On 3/24/12, Jonathan M Davis wrote:
> I can't think of any data structure that does that off the top of my head
Java has it and they call it a LinkedHashMap:
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/LinkedHashMap.html
> That _does_ require having two data structures in one, and the
On 3/23/12, Andrej Mitrovic wrote:
> Does someone have a map implementation that maintains the insertion
> order of the keys?
Here's a sloppy implementation:
module test;
import std.stdio;
import std.traits;
template KeyType(V : V[K], K)
if (isAssociativeArray!(V[K]))
{
alias K KeyType
On Friday, March 23, 2012 23:48:51 Andrej Mitrovic wrote:
> Does someone have a map implementation that maintains the insertion
> order of the keys?
>
> E.g.:
>
> string[string] map;
> map["foo"] = "x";
> map["bar"] = "y";
>
> When iterating over map keys I want to visit "foo" first, then "bar",
11 matches
Mail list logo