concurrent_map
[containers.concurrent_map]
oneapi::tbb::concurrent_map
はソートされてた連想コンテナーを表わすクラス・テンプレートです。固有の要素を保存して、同時挿入、ルックアップ、および走査をサポートしますが、同時消去はサポートされません。
クラス・テンプレートの概要
namespace oneapi {
namespace tbb {
template <typename Key,
typename T,
typename Compare = std::less<Key>,
typename Allocator = tbb_allocator<std::pair<const Key, T>>
class concurrent_map {
public:
using key_type = Key;
using mapped_type = T;
using value_type = std::pair<const Key, T>;
using size_type = <implementation-defined unsigned integer type>;
using difference_type = <implementation-defined signed integer type>;
using key_compare = Compare;
using allocator_type = Allocator;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = std::allocator_traits<Allocator>::pointer;
using const_pointer = std::allocator_traits<Allocator>::const_pointer;
using iterator = <implementation-defined ForwardIterator>;
using const_iterator = <implementation-defined constant ForwardIterator>;
using node_type = <implementation-defined node handle>;
using range_type = <implementation-defined range>;
using const_range_type = <implementation-defined constant node handle>;
class value_compare;
// Construction, destruction, copying
concurrent_map();
explicit concurrent_map( const key_compare& comp,
const allocator_type& alloc = allocator_type() );
explicit concurrent_map( const allocator_type& alloc );
template <typename InputIterator>
concurrent_map( InputIterator first, InputIterator last,
const key_compare& comp = key_compare(),
const allocator_type& alloc = allocator_type() );
template <typename InputIterator>
concurrent_map( InputIterator first, InputIterator last,
const allocator_type& alloc );
concurrent_map( std::initializer_list<value_type> init,
const key_compare& comp = key_compare(),
const allocator_type& alloc = allocator_type() );
concurrent_map( std::initializer_list<value_type> init, const allocator_type& alloc );
concurrent_map( const concurrent_map& other );
concurrent_map( const concurrent_map& other,
const allocator_type& alloc );
concurrent_map( concurrent_map&& other );
concurrent_map( concurrent_map&& other,
const allocator_type& alloc );
~concurrent_map();
concurrent_map& operator=( const concurrent_map& other );
concurrent_map& operator=( concurrent_map&& other );
concurrent_map& operator=( std::initializer_list<value_type> init );
allocator_type get_allocator() const;
// Element access
value_type& at( const key_type& key );
const value_type& at( const key_type& key ) const;
value_type& operator[]( const key_type& key );
value_type& operator[]( key_type&& key );
// Iterators
iterator begin();
const_iterator begin() const;
const_iterator cbegin() const;
iterator end();
const_iterator end() const;
const_iterator cend() const;
// Size and capacity
bool empty() const;
size_type size() const;
size_type max_size() const;
// Concurrently safe modifiers
std::pair<iterator, bool> insert( const value_type& value );
iterator insert( const_iterator hint, const value_type& value );
template <typename P>
std::pair<iterator, bool> insert( P&& value );
template <typename P>
iterator insert( const_iterator hint, P&& value );
std::pair<iterator, bool> insert( value_type&& value );
iterator insert( const_iterator hint, value_type&& value );
template <typename InputIterator>
void insert( InputIterator first, InputIterator last );
void insert( std::initializer_list<value_type> init );
std::pair<iterator, bool> insert( node_type&& nh );
iterator insert( const_iterator hint, node_type&& nh );
template <typename...Args>
std::pair<iterator, bool> emplace( Args&&... args );
template <typename...Args>
iterator emplace_hint( const_iterator hint, Args&&... args );
template <typename SrcCompare>
void merge( concurrent_map<Key, T, SrcCompare, Allocator>& source );
template <typename SrcCompare>
void merge( concurrent_map<Key, T, SrcCompare, Allocator>&& source );
template <typename SrcCompare>
void merge( concurrent_multimap<Key, T, SrcCompare, Allocator>& source );
template <typename SrcCompare>
void merge( concurrent_multimap<Key, T, SrcCompare, Allocator>&& source );
// Concurrently unsafe modifiers
void clear();
iterator unsafe_erase( const_iterator pos );
iterator unsafe_erase( iterator pos );
iterator unsafe_erase( const_iterator first, const_iterator last );
size_type unsafe_erase( const key_type& key );
template <typename K>
size_type unsafe_erase( const K& key );
node_type unsafe_extract( const_iterator pos );
node_type unsafe_extract( iterator pos );
node_type unsafe_extract( const key_type& key );
template <typename K>
node_type unsafe_extract( const K& key );
void swap( concurrent_map& other );
// Lookup
size_type count( const key_type& key );
template <typename K>
size_type count( const K& key );
iterator find( const key_type& key );
const_iterator find( const key_type& key ) const;
template <typename K>
iterator find( const K& key );
template <typename K>
const_iterator find( const K& key ) const;
bool contains( const key_type& key ) const;
template <typename K>
bool contains( const K& key ) const;
std::pair<iterator, iterator> equal_range( const key_type& key );
std::pair<const_iterator, const_iterator> equal_range( const key_type& key ) const;
template <typename K>
std::pair<iterator, iterator> equal_range( const K& key );
std::pair<const_iterator, const_iterator> equal_range( const K& key ) const;
iterator lower_bound( const key_type& key );
const_iterator lower_bound( const key_type& key ) const;
template <typename K>
iterator lower_bound( const K& key );
template <typename K>
const_iterator lower_bound( const K& key ) const;
iterator upper_bound( const key_type& key );
const_iterator upper_bound( const key_type& key ) const;
template <typename K>
iterator upper_bound( const K& key );
template <typename K>
const_iterator upper_bound( const K& key ) const;
// Observers
key_compare key_comp() const;
value_compare value_comp() const;
// Parallel iteration
range_type range();
const_range_type range() const;
}; // class concurrent_map
} // namespace tbb
} // namespace oneapi
要件:
式
std::allocator_traits<Allocator>::destroy(m, val)
、ここでm
はAllocator
タイプのオブジェクトとval
はvalue_type
タイプのオブジェクトは、整数式でなければなりません。メンバー関数は、操作タイプに応じてより厳密な要件を課す場合があります。Compare
タイプは、[alg.sorting] ISO C++ 標準のCompare
要件を満たしている必要があります。Allocator
タイプは、[allocator.requirements] ISO C++ 標準のAllocator
要件を満たしている必要があります。
メンバークラス
メンバー関数
非メンバー関数
これらの関数は、oneapi::tbb::concurrent_map
オブジェクトに対してバイナリーおよび辞書式の順序の比較とスワップ操作を提供します。
これらの関数が定義される名前空間は、それぞれの比較操作で使用できるかぎり未指定です。例えば、実装では、同じ内部名前空間でクラスと関数を定義し oneapi::tbb::concurrent_map
をタイプエイリアスとして定義できます。この場合、非メンバー関数には引数依存のルックアップによってのみ到達できます。
template <typename Key, typename T, typename Compare, typename Allocator>
void swap( concurrent_map<Key, T, Compare, Allocator>& lhs,
concurrent_map<Key, T, Compare, Allocator>& rhs );
template <typename Key, typename T, typename Compare, typename Allocator>
bool operator==( const concurrent_map<Key, T, Compare, Allocator>& lhs,
const concurrent_map<Key, T, Compare, Allocator>& rhs );
template <typename Key, typename T, typename Compare, typename Allocator>
bool operator!=( const concurrent_map<Key, T, Compare, Allocator>& lhs,
const concurrent_map<Key, T, Compare, Allocator>& rhs );
template <typename Key, typename T, typename Compare, typename Allocator>
bool operator<( const concurrent_map<Key, T, Compare, Allocator>& lhs,
const concurrent_map<Key, T, Compare, Allocator>& rhs );
template <typename Key, typename T, typename Compare, typename Allocator>
bool operator>( const concurrent_map<Key, T, Compare, Allocator>& lhs,
const concurrent_map<Key, T, Compare, Allocator>& rhs );
template <typename Key, typename T, typename Compare, typename Allocator>
bool operator<=( const concurrent_map<Key, T, Compare, Allocator>& lhs,
const concurrent_map<Key, T, Compare, Allocator>& rhs );
template <typename Key, typename T, typename Compare, typename Allocator>
bool operator>=( const concurrent_map<Key, T, Compare, Allocator>& lhs,
const concurrent_map<Key, T, Compare, Allocator>& rhs );