STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions
stapl::location_specific_storage< T > Class Template Reference

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.
 

Detailed Description

template<typename T>
class stapl::location_specific_storage< T >

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.

Member Function Documentation

◆ get()

template<typename T >
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&&...).

◆ try_get()

template<typename T >
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.


The documentation for this class was generated from the following file: