Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-01-09 12:16:07


From: "William E. Kempf" <wekempf_at_[hidden]>
> > From: "Peter Dimov" <pdimov_at_[hidden]>
> >
> > I think that a reasonable requirement that we already mentioned several
> > times is that the ID should be CopyConstructible, Assignable and
> > LessThanComparable, for use in sets/maps.
>
> This misses the need for outputting in diagnostic messages, for one thing.

No, this is an additional requirement that you missed; you already had the
output requirement in place.

> And all of this can be supplied directly by boost::thread with no need for
a
> boost::thead::id.

Just to clarify, do you mean

std::map<boost::thread *, int, dereferenced_compare> map;

?

boost::thread itself is not copyable, so it can't be a key.

How would this work?

void my_function()
{
    thread current;

    map_type::iterator i = map.find(&current); // 'get' is fine

    map[&current] = 5; // but 'set' is not, as &current will become invalid
soon
}


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