Asssociative Array by Key-Value-Pair

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 15 11:00:14 PST 2014


On Mon, Dec 15, 2014 at 06:46:20PM +0000, bearophile via Digitalmars-d-learn wrote:
> H. S. Teoh:
> 
> >I implemented this before, but it got rejected because people
> >insisted that it must return a range of Tuple, but Tuple is defined
> >in Phobos and druntime can't have dependencies on Phobos. :-(
> >
> >Maybe I'll take another shot at this, since this question keeps
> >coming up.
> 
> One possible solution: have a hidden but documented runtime function
> that yields 2-item structs, and add a "std.range.byPairs" range and a
> "std.range.pairs" function to Phobos that yield the tuples (byPairs
> could use a cast to convert the runtime struct to the Phobos tuple).
[...]

That's exactly what I plan to do. :-)


T

-- 
Let's call it an accidental feature. -- Larry Wall


More information about the Digitalmars-d-learn mailing list