ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] Re: Interest in bidirectional map?
by David B. Held other posts by this author
Oct 22 2002 8:24PM messages near this date
Re: [boost] Re: Interest in bidirectional map? | [boost] Re: Interest in bidirectional map?
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



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:

Dirk Gerrits
David B. Held
Dirk Gerrits
=?iso-8859-1?Q?Joaqu=EDn=20M=AA=20L=F3pez=20Mu=F1oz?=
David B. Held
David B. Held
David B. Held
David B. Held
Jeremy B. Maitin-Shepard

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved