STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types
stapl::runtime::shared_object_factory< Key, Hash, KeyEqual > Class Template Reference

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
 

Detailed Description

template<typename Key, typename Hash = std::hash<Key>, typename KeyEqual = std::equal_to<Key>>
class stapl::runtime::shared_object_factory< Key, Hash, 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.

Member Function Documentation

◆ create()

template<typename Key, typename Hash = std::hash<Key>, typename KeyEqual = std::equal_to<Key>>
template<typename T , typename... Args>
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.

Warning
Only one shared object is allowed per key.
Parameters
keyKey to index a shared object of type T.
NNumber of threads requesting the object.
argsArguments to pass to the constructor of the shared object.

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