|
Boost : |
Subject: Re: [boost] [any] new version
From: Martin Bidlingmaier (Martin.Bidlingmaier_at_[hidden])
Date: 2011-09-02 14:58:13
So there are actually two main issues that need to be taken care of:
- 1. dlls
I think a good solution would be to add a new class, e.g. as
Andrey Semashev proposed 'local_any', that derives from the current
version of any.
The normal version could be used for inter dll passing, the new version
when the user can assure that a local_any instance won't be passed between
dlls.
Conversion could be provided from local_any to any.
- 2. thread safety
In c++03, variables defined at namespace scope are not necessarily
initialized before main(), so there could be data races for the
previous_id in next_id() in multi threaded applications.
One simple way out would be to lock the variabe when used, but this would
add the dependency on a threading library (does boost provide
locking header only or does it need building?).
It would be interesting to know, what c++11 says about the initialization
of static data members. If it prohibits more than one initialization at a
time or requires single threaded initialization before main() ,
locking will not be needed.
-- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk