Factory for creating object shared between threads. More...
Public Member Functions | |
template<typename T , typename... Args> | |
std::shared_ptr< T > | create (key_type const &key, size_type n, Args &&... args) |
Returns an object of type T that is shared among threads. More... | |
Public Types | |
using | size_type = std::size_t |
using | key_type = Key |
using | hasher = Hash |
using | key_equal = KeyEqual |
Factory for creating object shared between threads.
The shared objects are indexed with the Key
type and are returned as reference counted pointers through std::shared_ptr
.
std::shared_ptr<T> stapl::runtime::shared_object_factory< Key, Hash, KeyEqual >::create | ( | key_type const & | key, |
size_type | n, | ||
Args &&... | args | ||
) |
Returns an object of type T
that is shared among threads.
The returned object is valid for n
requesting threads and is indexed with key
.
key | Key to index a shared object of type T . |
N | Number of threads requesting the object. |
args | Arguments to pass to the constructor of the shared object. |