The enumerable_thread_specific container. More...
#include <enumerable_thread_specific.h>
Public Types | |
typedef Allocator | allocator_type |
Basic types. | |
typedef T | value_type |
typedef T & | reference |
typedef const T & | const_reference |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef internal_collection_type::size_type | size_type |
typedef internal_collection_type::difference_type | difference_type |
typedef internal::enumerable_thread_specific_iterator < internal_collection_type, value_type > | iterator |
typedef internal::enumerable_thread_specific_iterator < internal_collection_type, const value_type > | const_iterator |
typedef generic_range_type < iterator > | range_type |
typedef generic_range_type < const_iterator > | const_range_type |
Public Member Functions | |
enumerable_thread_specific () | |
Default constructor. Each local instance of T is default constructed. | |
template<typename Finit > | |
enumerable_thread_specific (Finit finit) | |
Constructor with initializer functor. Each local instance of T is constructed by T(finit()). | |
enumerable_thread_specific (const T &exemplar) | |
Constructor with exemplar. Each local instance of T is copied-constructed from the exemplar. | |
~enumerable_thread_specific () | |
Destructor. | |
reference | local () |
returns reference to local, discarding exists | |
reference | local (bool &exists) |
Returns reference to calling thread's local copy, creating one if necessary. | |
size_type | size () const |
Get the number of local copies. | |
bool | empty () const |
true if there have been no local copies created | |
iterator | begin () |
begin iterator | |
iterator | end () |
end iterator | |
const_iterator | begin () const |
begin const iterator | |
const_iterator | end () const |
end const iterator | |
range_type | range (size_t grainsize=1) |
Get range for parallel algorithms. | |
const_range_type | range (size_t grainsize=1) const |
Get const range for parallel algorithms. | |
void | clear () |
Destroys local copies. | |
template<typename U , typename Alloc , ets_key_usage_type Cachetype> | |
enumerable_thread_specific (const enumerable_thread_specific< U, Alloc, Cachetype > &other) | |
enumerable_thread_specific (const enumerable_thread_specific &other) | |
enumerable_thread_specific & | operator= (const enumerable_thread_specific &other) |
template<typename U , typename Alloc , ets_key_usage_type Cachetype> | |
enumerable_thread_specific & | operator= (const enumerable_thread_specific< U, Alloc, Cachetype > &other) |
template<typename combine_func_t > | |
T | combine (combine_func_t f_combine) |
template<typename combine_func_t > | |
void | combine_each (combine_func_t f_combine) |
Friends | |
template<typename U , typename A , ets_key_usage_type C> | |
class | enumerable_thread_specific |
The enumerable_thread_specific container.
enumerable_thread_specific has the following properties: - thread-local copies are lazily created, with default, exemplar or function initialization. - thread-local copies do not move (during lifetime, and excepting clear()) so the address of a copy is invariant. - the contained objects need not have operator=() defined if combine is not used. - enumerable_thread_specific containers may be copy-constructed or assigned. - thread-local copies can be managed by hash-table, or can be accessed via TLS storage for speed. - outside of parallel contexts, the contents of all thread-local copies are accessible by iterator or using combine or combine_each methods