Bill Baxter Wrote: > On Tue, Dec 2, 2008 at 6:40 AM, Jarrett Billingsley > <[EMAIL PROTECTED]> wrote: > > On Mon, Dec 1, 2008 at 4:19 PM, llee <[EMAIL PROTECTED]> wrote: > >> Is is possible to index the elements within a tuple using strings? > >> Something similar to the way that associative arrays allow elements to be > >> indexed using strings. > >> > > > > No, because that makes no sense. > > > > What does tuple["string"] mean, anyway? > > Tuples have an annoying "auto-flattening" behavior which means that > it's difficult to create very advanced data structures out of them. > But you can create a flat tuple a-list with entries like "fred", > int, "barney", double, "wilma", ireal > Then you can write some template functions that will scan through the > list for a particular string and return the following type if there's > a match. You will need to use lots of recursive template-fu. > > --bb
... Or you can just loop over the tuple and return the matching index... No recursive template-foo needed
