Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-10-22 15:24:53


Dirk Gerrits wrote:

> [...]
> How exactly did multi-threading come into play? Or did you refer to
> some other meaning of 'threaded'? :)

Yes. In tree terminology, "threading" means to use leaf child pointers
to create a "fast" inorder traversal. I was just abusing this term
somewhat to refer to tree pointers in general (imagine two trees over
the same set of nodes, where each node occupies a different location in
each tree...the "branches" of the trees are like "threads" that are
"interwoven").

> [...]
> > Possibly a syntax like this could be possible:
> >
> > nmap map;
> > map.key<1>["joe"] = employee_record;
> > map.key<2>["123-45-6789"] = employee2;
> > employee_id = map[35]; // defaults to .key<0>
>
> Yes very nice indeed. However, is that syntax supported on all
> compilers that Boost is generally compatible with?

I would strive to make it so.

> I thought MSVC6 had problems with explicitly specifying template
> arguments to function templates.

Hmm...after playing around with it, my preferred syntax doesn't seem
possible. However, this looks promising, and can probably be
implemented with the preprocessor library:

template <typename K1, typename K2, ...>
class map
{
public:
     template <typename T>
     class key
     {
     public:
         int operator[](T) { return 5; }
     };
     key<K1> key0;
     key<K2> key1;
};

int main()
{
     map<int, char> m;
     m.key0[3];
}

> In any case, the library suggestions in this thread seem promising.

Oh, so now we're back to single threading? ;)

> I would definately welcome a general map and/or an efficient
> bidirectional-map. (If the latter can be done with the former as you
> suggest, all the better! :)

I'm glad someone else thinks so.

Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk