> From: Rene Rivera <[EMAIL PROTECTED]>
> [2003-01-09] William E. Kempf wrote:
> 
> >> From: Rene Rivera <[EMAIL PROTECTED]>
> >> The one place I would like to have such a thing it would have to be id().
> >> 
> >> I have one, very overused, place in my code where I have to iterate on a
> >> list of objects, which have thread pointers to find the object given the
> >> current thread. It would somewhat cleaner and easier to understand if I
> >> could have a std::map<thread::ID,object*> instead.
> >
> >That doesn't necessarily speak for an ID type in addition to boost::thread. 
> It only 
> >adds another requirement that could be met by boost::thread itself.  Either
> an 
> >operator<(), knowing that the ordering is arbitrary, or follow the same
> route as 
> >std::type_info and include a before().  Thoughts?
> 
> Having an operator<() would work, but not be as convenient as an ID. In my
> simple thread.ID -> object* sample I would have to change it to thread* ->
> object* and add the dereference ops accordingly. So I would still prefer the
> ID, it's just cleaner and easier to understand.

I don't follow this.  First, why are you using a thread* in the first place?  Why not 
just a thread?  (Remember that the new thread design is Copyable and Assignable.)  
Seems the map should just be:

typedef std::map<boost::thread, Object*> my_map;

which works if we make thread LessThanComparable.

> 
> -- grafik - Don't Assume Anything
> -- [EMAIL PROTECTED] - [EMAIL PROTECTED]
> -- 102708583@icq
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
> 

William E. Kempf
[EMAIL PROTECTED]

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

Reply via email to