|
Boost : |
From: Janek Kozicki (janek_listy_at_[hidden])
Date: 2006-11-21 04:24:33
Thorsten Ottosen said: (by the date of Tue, 21 Nov 2006 00:03:21 +0100)
> Janek Kozicki wrote:
> > Using Boost.MultiIndex with Boost.PtrContainer would be great.
>
> It's certainly something I have considered, though I'm not sure what the
> best approach is. It would take some investigation, and I'm not able to
> invest that time in the foreseeable future.
>
> OTOH, I would be happy to help out with feedback if someone took on the
> task.
Thanks for your reply :)
I'm still thinking how to best refactor my current containers. They
are in bad need for refactoring and I'm still not sure where to go.
MultiIndex + PtrContainer are one of alternatives. If it turns out
that this is the way to go, I will want to try this task.
Also I'm sure that my new container will have to support threading. I
was thinking about something like accessor methods that will lock for
reading and lock for writing:
template <T>
class my_superb_container {
// only one can write to item 'item_index', no reading allowed
T& lock_write(int item_index);
// multiple reads of item 'item_index' are allowed, no writing
const T& lock_read(int item_index);
}
Lock will be released when leaving current block, in the destructor.
(destructor of what? - still thinking about that).
The operator[] will not be provided. Only lock_write() and lock_read().
This my_superb_container will need to store mutexes in another
container - one mutex per each item.
Has anoyone thought about that? (the thread-capable containers)
-- Janek Kozicki |
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk