From: Peter Brooks <peter.h.m.brooks@gmail.com>
Subject: Multiple keys for a map
Date: Tue, 17 Sep 2013 07:51:24 -0700 (PDT)
Date: 2013-09-17T07:51:24-07:00 [thread overview]
Message-ID: <4f66d847-d030-4aa9-8bdf-9bcc5f3a0852@googlegroups.com> (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?
next reply other threads:[~2013-09-17 14:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 14:51 Peter Brooks [this message]
2013-09-17 16:52 ` Multiple keys for a map 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox