comp.lang.ada
 help / color / mirror / Atom feed
* Multiple keys for a map
@ 2013-09-17 14:51 Peter Brooks
  2013-09-17 16:52 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Peter Brooks @ 2013-09-17 14:51 UTC (permalink / raw)


I know that maps in Containers.Hashed_Maps and Containers.Ordered_Map are designed as single-key look-up tables.

Is there an extension that allows multiple keys? 

I'd like to be able to do something like this:

procedure Insert (Container : in out Map;
                  key1, key2, key3       : in     Key_Type;
                  New_Item  : in     Element_Type;
                  Position  :    out Cursor;
                  Inserted  :    out Boolean);

allowing:

insert(my_map,"fox","jumps","dog","The quick brown fox jumps over the lazy dog",location,succeeded);
insert(my_map,"cow","jumps","moon","The cow jumps over the moon",location,succeeded);
insert(my_map,"dog","jumps","log","The lazy dog jumps over the small log",location,succeeded);
insert(my_map,"dog","jumps","bed","The very lazy dog jumps into bed",location,succeeded)

So that later, I can have:


Subject := find(my_map,"fox",-,-);
Verb := find(my_map,-,"jumps",-);
Object := find(my_map,-,-,"dog");

and, after this:

Subject = Verb = Object;

I know this could be done with three calls to Insert, but I also want to be able to call:

find(mymap,"fox","jumps","dog") => true

and

find(mymap,"dog","jumps","fox") => false

and, ideally,

find(myman,"dog",-,-) => 

"The Lazy dog jumps over the small log"
"The very lazy dog jumps into bed"

Any suggestions?



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-09-18  9:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-17 14:51 Multiple keys for a map Peter Brooks
2013-09-17 16:52 ` Dmitry A. Kazakov
2013-09-17 17:49   ` Peter Brooks
2013-09-18  7:22     ` Dmitry A. Kazakov
2013-09-18  9:34       ` Peter Brooks
2013-09-17 18:57 ` gautier_niouzes
2013-09-17 19:20   ` Peter Brooks
2013-09-18  5:19 ` Shark8
2013-09-18  5:44   ` Peter Brooks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox