Supports global objects in the presence of locations. More...
Public Member Functions | |
| location_specific_storage (void) | |
Creates a location_specific_storage object that default constructs the underlying T object. | |
| template<typename... Args> | |
| location_specific_storage (Args &&... args) | |
Creates a location_specific_storage object that calls the constructor of the underlying T object with the given arguments. | |
| template<typename U > | |
| T & | reset (U &&u) |
| Replaces the stored object. | |
| T & | get (void) const |
Returns the stored T object. More... | |
| T * | try_get (void) const |
Attempts to return the stored T object. More... | |
| void | destroy (void) |
Destroys the stored T object. | |
Supports global objects in the presence of locations.
All non-const global object have to be declared as location_specific_storage objects, since locations are effectively virtual threads. This class is modeled after boost::thread_specific_ptr.
Global const variables do not have to be instances of location_specific_storage, since the latter imposes some additional overhead.
| T& stapl::location_specific_storage< T >::get | ( | void | ) | const |
Returns the stored T object.
If a stored object T has not been created yet, it will be created with any arguments given through location_specific_storage(Args&&...).
| T* stapl::location_specific_storage< T >::try_get | ( | void | ) | const |
Attempts to return the stored T object.
If a stored object T has not been created yet, it returns nullptr.
1.8.13