Standard library header <flat_map> (C++23)
From cppreference.net
このヘッダは containers ライブラリの一部です。
インクルード |
||
|
(C++20)
|
三方比較演算子 サポート | |
|
(C++11)
|
std::initializer_list クラステンプレート | |
クラス |
||
|
(C++23)
|
2つのコンテナを適合させ、一意のキーでソートされたキーと値のペアのコレクションを提供する
(クラステンプレート) |
|
|
(C++23)
|
2つのコンテナを適合させ、キーでソートされたキーと値のペアのコレクションを提供する
(クラステンプレート) |
|
|
std::uses_allocator
型特性を特殊化する
(クラステンプレート特殊化) |
||
|
std::uses_allocator
型特性を特殊化する
(クラステンプレート特殊化) |
||
関数 |
||
|
(C++23)
|
特定の条件を満たすすべての要素を削除する
(関数テンプレート) |
|
|
(C++23)
|
特定の条件を満たすすべての要素を削除する
(関数テンプレート) |
|
タグ |
||
|
(C++23)
|
範囲の要素がソートされ一意であることを示す
(タグ) |
|
|
範囲の要素がソートされていることを示す(一意性は不要)
(タグ) |
||
概要
#include <compare> #include <initializer_list> namespace std { // クラステンプレート flat_map template<class Key, class T, class Compare = less<Key>, class KeyContainer = vector<Key>, class MappedContainer = vector<T>> class flat_map; struct sorted_unique_t { explicit sorted_unique_t() = default; }; inline constexpr sorted_unique_t sorted_unique{}; template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Allocator> struct uses_allocator<flat_map<Key, T, Compare, KeyContainer, MappedContainer>, Allocator>; // flat_map のための消去機能 template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Predicate> typename flat_map<Key, T, Compare, KeyContainer, MappedContainer>::size_type erase_if( flat_map<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred); // クラステンプレート flat_multimap template<class Key, class T, class Compare = less<Key>, class KeyContainer = vector<Key>, class MappedContainer = vector<T>> class flat_multimap; struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; }; inline constexpr sorted_equivalent_t sorted_equivalent{}; template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Allocator> struct uses_allocator<flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>, Allocator>; // flat_multimap のための消去機能 template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Predicate> typename flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>::size_type erase_if(flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred); }
クラステンプレート std:: flat_map
namespace std {
template<class Key,
class T,
class Compare = less<Key>,
class KeyContainer = vector<Key>,
class MappedContainer = vector<T>>
class flat_map
{
public:
// 型
using key_type = Key;
using mapped_type = T;
using value_type = pair<key_type, mapped_type>;
using key_compare = Compare;
using reference = pair<const key_type&, mapped_type&>;
using const_reference = pair<const key_type&, const mapped_type&>;
using size_type = size_t;
using difference_type = ptrdiff_t;
using iterator = /* 実装定義 */;
using const_iterator = /* 実装定義 */;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using key_container_type = KeyContainer;
using mapped_container_type = MappedContainer;
class value_compare
{
private:
key_compare comp; // 説明専用
value_compare(key_compare c)
: comp(c)
{
} // 説明専用
public:
bool operator()(const_reference x, const_reference y) const
{
return comp(x.first, y.first);
}
};
struct containers
{
key_container_type keys;
mapped_container_type values;
};
// コンストラクタ
flat_map()
: flat_map(key_compare())
{
}
explicit flat_map(const key_compare& comp)
: c()
, compare(comp)
{
}
flat_map(key_container_type key_cont,
mapped_container_type mapped_cont,
const key_compare& comp = key_compare());
flat_map(sorted_unique_t,
key_container_type key_cont,
mapped_container_type mapped_cont,
const key_compare& comp = key_compare());
template<class InputIter>
flat_map(InputIter first, InputIter last, const key_compare& comp = key_compare())
: c()
, compare(comp)
{
insert(first, last);
}
template<class InputIter>
flat_map(sorted_unique_t s,
InputIter first,
InputIter last,
const key_compare& comp = key_compare())
: c()
, compare(comp)
{
insert(s, first, last);
}
template<container-compatible-range<value_type> R>
flat_map(from_range_t fr, R&& rg)
: flat_map(fr, std::forward
(注:指定された条件により、HTMLタグ・属性は一切翻訳せず、タグ内のテキストも翻訳対象外です。C++固有の用語「std::forward」は翻訳していません)<R>(rg), key_compare())
{
}
template<container-compatible-range<value_type> R>
flat_map(from_range_t, R&& rg, const key_compare& comp)
: flat_map(comp)
{
insert_range(std::forward<R>(rg));
}
flat_map(initializer_list<value_type> il, const key_compare& comp = key_compare())
: flat_map(il.begin(), il.end(), comp)
{
}
flat_map(sorted_unique_t s,
initializer_list<value_type> il,
const key_compare& comp = key_compare())
: flat_map(s, il.begin(), il.end(), comp)
{
}
// アロケータ付きコンストラクタ
template<class Alloc>
explicit flat_map(const Alloc& a);
template<class Alloc>
flat_map(const key_compare& comp, const Alloc& a);
template<class Alloc>
flat_map(const key_container_type& key_cont,
const mapped_container_type& mapped_cont,
const Alloc& a);
template<class Alloc>
flat_map(const key_container_type& key_cont,
const mapped_container_type& mapped_cont,
const key_compare& comp,
const Alloc& a);
template<class Alloc>
flat_map(sorted_unique_t,
const key_container_type& key_cont,
const mapped_container_type& mapped_cont,
const Alloc& a);
template<class Alloc>
flat_map(sorted_unique_t,
const key_container_type& key_cont,
const mapped_container_type& mapped_cont,
const key_compare& comp,
const Alloc& a);
template<class Alloc>
flat_map(const flat_map&, const Alloc& a);
template<class Alloc>
flat_map(flat_map&&, const Alloc& a);
template<class InputIter, class Alloc>
flat_map(InputIter first, InputIter last, const Alloc& a);
template<class InputIter, class Alloc>
flat_map(InputIter first, InputIter last, const key_compare& comp, const Alloc& a);
template<class InputIter, class Alloc>
flat_map(sorted_unique_t, InputIter first, InputIter last, const Alloc& a);
template<class InputIter, class Alloc>
flat_map(sorted_unique_t,
InputIter first,
InputIter last,
const key_compare& comp,
const Alloc& a);
template<container-compatible-range<value_type> R, class Alloc>
flat_map(from_range_t, R&& rg, const Alloc& a);
template<container-compatible-range<value_type> R, class Alloc>
flat_map(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
template<class Alloc>
flat_map(initializer_list<value_type> il, const Alloc& a);
template<class Alloc>
flat_map(initializer_list<value_type> il, const key_compare& comp, const Alloc& a);
template<class Alloc>
flat_map(sorted_unique_t, initializer_list<value_type> il, const Alloc& a);
template<class Alloc>
flat_map(sorted_unique_t,
initializer_list<value_type> il,
const key_compare& comp,
const Alloc& a);
flat_map& operator=(initializer_list<value_type>);
// イテレータ
iterator begin() noexcept;
const_iterator begin() const noexcept;
iterator end() noexcept;
const_iterator end() const noexcept;
reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;
reverse_iterator rend() noexcept;
const_reverse_iterator rend() const noexcept;
const_iterator cbegin() const noexcept;
const_iterator cend() const noexcept;
const_reverse_iterator crbegin() const noexcept;
const_reverse_iterator crend() const noexcept;
// capacity
bool empty() const noexcept;
size_type size() const noexcept;
size_type max_size() const noexcept;
// 要素アクセス
mapped_type& operator[](const key_type& x);
mapped_type& operator[](key_type&& x);
template<class K>
mapped_type& operator[]
(注:元のテキストは閉じ括弧のみのため、日本語でも同じ記号を保持します)(K&& x);
mapped_type& at(const key_type& x);
const mapped_type& at(const key_type& x) const;
template<class K>
mapped_type& at(const K& x);
template<class K>
const mapped_type& at(const K& x) const;
// 修飾子
template<class... Args>
pair<iterator, bool> emplace(Args&&... args);
template<class... Args>
iterator emplace_hint(const_iterator position, Args&&... args);
pair<iterator, bool> insert(const value_type& x) { return emplace(x); }
pair<iterator, bool> insert(value_type&& x) { return emplace(std::move(x)); }
iterator insert(const_iterator position, const value_type& x)
{
return emplace_hint(position, x);
}
iterator insert(const_iterator position, value_type&& x)
{
return emplace_hint(position, std::move(x));
}
template<class P>
pair<iterator, bool> insert(P&& x);
template<class P>
iterator insert(const_iterator position, P&&);
template<class InputIter>
void insert(InputIter first, InputIter last);
template<class InputIter>
void insert(sorted_unique_t, InputIter first, InputIter last);
template<container-compatible-range<value_type> R>
void insert_range(R&& rg);
void insert(initializer_list<value_type> il) { insert(il.begin(), il.end()); }
void insert(sorted_unique_t s, initializer_list<value_type> il)
{
insert(s, il.begin(), il.end());
}
containers extract() &&;
void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont);
template<class... Args>
pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
template<class... Args>
pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
template<class K, class... Args>
pair<iterator, bool> try_emplace(K&& k, Args&&... args);
template<class... Args>
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
template<class... Args>
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
template<class K, class... Args>
iterator try_emplace(const_iterator hint, K&& k, Args&&... args);
template<class M>
pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
template<class M>
pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
template<class K, class M>
pair<iterator, bool> insert_or_assign(K&& k, M&& obj);
template<class M>
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
template<class M>
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
template<class K, class M>
iterator insert_or_assign(const_iterator hint, K&& k, M&& obj);
iterator erase(iterator position);
iterator erase(const_iterator position);
size_type erase(const key_type& x);
template<class K>
size_type erase(K&& x);
iterator erase(const_iterator first, const_iterator last);
void swap(flat_map& y) noexcept;
void clear() noexcept;
// オブザーバー
key_compare key_comp() const;
value_compare value_comp() const;
const key_container_type& keys() const noexcept { return c.keys; }
const mapped_container_type& values() const noexcept { return c.values; }
// マップ操作
iterator find(const key_type& x);
const_iterator find(const key_type& x) const;
template<class K>
iterator find(const K& x);
template<class K>
const_iterator find(const K& x) const;
size_type count(const key_type& x) const;
template<class K>
size_type count(const K& x) const;
bool contains(const key_type& x) const;
template<class K>
bool contains(const K& x) const;
iterator lower_bound(const key_type& x);
const_iterator lower_bound(const key_type& x) const;
template<class K>
iterator lower_bound(const K& x);
template<class K>
const_iterator lower_bound(const K& x) const;
iterator upper_bound(const key_type& x);
const_iterator upper_bound(const key_type& x) const;
template<class K>
iterator upper_bound(const K& x);
template<class K>
const_iterator upper_bound(const K& x) const;
pair<iterator, iterator> equal_range(const key_type& x);
pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
template<class K>
pair<iterator, iterator> equal_range(const K& x);
template<class K>
pair<const_iterator, const_iterator> equal_range(const K& x) const;
friend bool operator==(const flat_map& x, const flat_map& y);
friend /*synth-three-way-result*/<value_type> operator<=>(const flat_map& x,
const flat_map& y);
friend void swap(flat_map& x, flat_map& y) noexcept { x.swap(y); }
private:
containers c; // 説明専用
key_compare compare; // 説明専用
struct key_equiv
{ // 説明専用
key_equiv(key_compare c)
: comp(c)
{
}
bool operator()(const_reference x, const_reference y) const
{
return !comp(x.first, y.first) && !comp(y.first, x.first);
}
key_compare comp;
};
};
template<class KeyContainer,
class MappedContainer,
class Compare = less<typename KeyContainer::value_type>>
flat_map(KeyContainer, MappedContainer, Compare = Compare())
-> flat_map<typename KeyContainer::value_type,
typename MappedContainer::value_type,
Compare,
KeyContainer,
MappedContainer>;
template<class KeyContainer, class MappedContainer, class Allocator>
flat_map(KeyContainer, MappedContainer, Allocator)
-> flat_map<typename KeyContainer::value_type,
typename MappedContainer::value_type,
less<typename KeyContainer::value_type>,
KeyContainer,
MappedContainer>;
template<class KeyContainer, class MappedContainer, class Compare, class Allocator>
flat_map(KeyContainer, MappedContainer, Compare, Allocator)
-> flat_map<typename KeyContainer::value_type,
typename MappedContainer::value_type,
Compare,
KeyContainer,
MappedContainer>;
template<class KeyContainer,
class MappedContainer,
class Compare = less<typename KeyContainer::value_type>>
flat_map(sorted_unique_t, KeyContainer, MappedContainer, Compare = Compare())
-> flat_map<typename KeyContainer::value_type,
typename MappedContainer::value_type,
Compare,
KeyContainer,
MappedContainer>;
template<class KeyContainer, class MappedContainer, class Allocator>
flat_map(sorted_unique_t, KeyContainer, MappedContainer, Allocator)
-> flat_map<typename KeyContainer::value_type,
typename MappedContainer::value_type,
less<typename KeyContainer::value_type>,
KeyContainer,
MappedContainer>;
template<class KeyContainer, class MappedContainer, class Compare, class Allocator>
flat_map(sorted_unique_t, KeyContainer, MappedContainer, Compare, Allocator)
-> flat_map<typename KeyContainer::value_type,
typename MappedContainer::value_type,
Compare,
KeyContainer,
MappedContainer>;
template<class InputIter, class Compare = less</*iter-key-type*/<InputIter>>>
flat_map(InputIter, InputIter, Compare = Compare())
-> flat_map</*iter-key-type*/<InputIter>, /*iter-mapped-type*/<InputIter>, Compare>;
template<class InputIter, class Compare = less</*iter-key-type*/<InputIter>>>
flat_map(sorted_unique_t, InputIter, InputIter, Compare = Compare())
-> flat_map</*iter-key-type*/<InputIter>, /*iter-mapped-type*/<InputIter>, Compare>;
template<ranges::input_range
(注:指定された条件により、HTMLタグ・属性は保持され、C++固有用語である"ranges::input_range"は翻訳対象外のため、元のテキストをそのまま保持しています) R,
class Compare = less</*range-key-type*/<R>>,
class Allocator = allocator<byte>>
flat_map(from_range_t, R&&, Compare = Compare(), Allocator = Allocator()) -> flat_map<
/*range-key-type*/<R>,
/*範囲マップ型*/<R>,
Compare,
vector</*range-key-type*/<R>, /*alloc-rebind*/<Allocator, /*range-key-type*/<R>>>,
vector</*範囲マップ型*/<R>,
/*alloc-rebind*/<Allocator, /*範囲マップ型*/<R>>>>;
template<ranges::input_range
(注:指定された条件により、HTMLタグ・属性は保持され、C++固有用語である"ranges::input_range"は翻訳対象外のため、元のテキストをそのまま保持しています) R, class Allocator>
flat_map(from_range_t, R&&, Allocator) -> flat_map<
/*range-key-type*/<R>,
/*範囲マップ型*/<R>,
less</*range-key-type*/<R>>,
vector</*range-key-type*/<R>, /*alloc-rebind*/<Allocator, /*範囲キー型*/<R>>>,
vector</*範囲マップ型*/<R>,
/*alloc-rebind*/<Allocator, /*範囲マップ型*/<R>>>>;
template<class Key, class T, class Compare = less<Key>>
flat_map(initializer_list<pair<Key, T>>, Compare = Compare())
-> flat_map<Key, T, Compare>;
template<class Key, class T, class Compare = less<Key>>
flat_map(sorted_unique_t, initializer_list<pair<Key, T>>, Compare = Compare())
-> flat_map<Key, T, Compare>;
template<class Key,
class T,
class Compare,
class KeyContainer,
class MappedContainer,
class Allocator>
struct uses_allocator<flat_map<Key, T, Compare, KeyContainer, MappedContainer>,
Allocator>
: bool_constant<uses_allocator_v<KeyContainer, Allocator> &&
uses_allocator_v<MappedContainer, Allocator>>
{};
}
クラステンプレート std:: flat_multimap
namespace std { template<class Key, class T, class Compare = less<Key>, class KeyContainer = vector<Key>, class MappedContainer = vector<T>> class flat_multimap { public: // 型 using key_type = Key; using mapped_type = T; using value_type = pair<key_type, mapped_type>; using key_compare = Compare; using reference = pair<const key_type&, mapped_type&>; using const_reference = pair<const key_type&, const mapped_type&>; using size_type = size_t; using difference_type = ptrdiff_t; using iterator = /* 実装定義 */; using const_iterator = /* 実装定義 */; using reverse_iterator = std::reverse_iterator<iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>; using key_container_type = KeyContainer; using mapped_container_type = MappedContainer; class value_compare { private: key_compare comp; // 説明専用 value_compare(key_compare c) : comp(c) { } // 説明専用 public: bool operator()(const_reference x, const_reference y) const { return comp(x.first, y.first); } }; struct containers { key_container_type keys; mapped_container_type values; }; // コンストラクタ flat_multimap() : flat_multimap(key_compare()) { } explicit flat_multimap(const key_compare& comp) : c() , compare(comp) { } flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); flat_multimap(sorted_equivalent_t, key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); template<class InputIter> flat_multimap(InputIter first, InputIter last, const key_compare& comp = key_compare()) : c() , compare(comp) { insert(first, last); } template<class InputIter> flat_multimap(sorted_equivalent_t s, InputIter first, InputIter last, const key_compare& comp = key_compare()) : c() , compare(comp) { insert(s, first, last); } template<container-compatible-range<value_type> R> flat_multimap(from_range_t fr, R&& rg) : flat_multimap(fr, std::forward<R>(rg), key_compare()) { } template<container-compatible-range<value_type> R> flat_multimap(from_range_t, R&& rg, const key_compare& comp) : flat_multimap(comp) { insert_range(std::forward<R>(rg)); } flat_multimap(initializer_list<value_type> il, const key_compare& comp = key_compare()) : flat_multimap(il.begin(), il.end(), comp) { } flat_multimap(sorted_equivalent_t s, initializer_list<value_type> il, const key_compare& comp = key_compare()) : flat_multimap(s, il.begin(), il.end(), comp) { } // アロケータ付きコンストラクタ template<class Alloc> explicit flat_multimap(const Alloc& a); template<class Alloc> flat_multimap(const key_compare& comp, const Alloc& a); template<class Alloc> flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, const Alloc& a); template<class Alloc> flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, const key_compare& comp, const Alloc& a); template<class Alloc> flat_multimap(sorted_equivalent_t, const key_container_type& key_cont, const mapped_container_type& mapped_cont, const Alloc& a); template<class Alloc> flat_multimap(sorted_equivalent_t, const key_container_type& key_cont, const mapped_container_type& mapped_cont, const key_compare& comp, const Alloc& a); template<class Alloc> flat_multimap(const flat_multimap&, const Alloc& a); template<class Alloc> flat_multimap(flat_multimap&&, const Alloc& a); template<class InputIter, class Alloc> flat_multimap(InputIter first, InputIter last, const Alloc& a); template<class InputIter, class Alloc> flat_multimap(InputIter first, InputIter last, const key_compare& comp, const Alloc& a); template<class InputIter, class Alloc> flat_multimap(sorted_equivalent_t, InputIter first, InputIter last, const Alloc& a); template<class InputIter, class Alloc> flat_multimap(sorted_equivalent_t, InputIter first, InputIter last, const key_compare& comp, const Alloc& a); template<container-compatible-range<value_type> R, class Alloc> flat_multimap(from_range_t, R&& rg, const Alloc& a); template<container-compatible-range<value_type> R, class Alloc> flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); template<class Alloc> flat_multimap(initializer_list<value_type> il, const Alloc& a); template<class Alloc> flat_multimap(initializer_list<value_type> il, const key_compare& comp, const Alloc& a); template<class Alloc> flat_multimap(sorted_equivalent_t, initializer_list<value_type> il, const Alloc& a); template<class Alloc> flat_multimap(sorted_equivalent_t, initializer_list<value_type> il, const key_compare& comp, const Alloc& a); flat_multimap& operator=(initializer_list<value_type>); // イテレータ iterator begin() noexcept; const_iterator begin() const noexcept; iterator end() noexcept; const_iterator end() const noexcept; reverse_iterator rbegin() noexcept; const_reverse_iterator rbegin() const noexcept; reverse_iterator rend() noexcept; const_reverse_iterator rend() const noexcept; const_iterator cbegin() const noexcept; const_iterator cend() const noexcept; const_reverse_iterator crbegin() const noexcept; const_reverse_iterator crend() const noexcept; // capacity bool empty() const noexcept; size_type size() const noexcept; size_type max_size() const noexcept; // 修飾子 template<class... Args> iterator emplace(Args&&... args); template<class... Args> iterator emplace_hint(const_iterator position, Args&&... args); iterator insert(const value_type& x) { return emplace(x); } iterator insert(value_type&& x) { return emplace(std::move(x)); } iterator insert(const_iterator position, const value_type& x) { return emplace_hint(position, x); } iterator insert(const_iterator position, value_type&& x) { return emplace_hint(position, std::move(x)); } template<class P> iterator insert(P&& x); template<class P> iterator insert(const_iterator position, P&&); template<class InputIter> void insert(InputIter first, InputIter last); template<class InputIter> void insert(sorted_equivalent_t, InputIter first, InputIter last); template<container-compatible-range<value_type> R> void insert_range(R&& rg); void insert(initializer_list<value_type> il) { insert(il.begin(), il.end()); } void insert(sorted_equivalent_t s, initializer_list<value_type> il) { insert(s, il.begin(), il.end()); } containers extract() &&; void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont); iterator erase(iterator position); iterator erase(const_iterator position); size_type erase(const key_type& x); template<class K> size_type erase(K&& x); iterator erase(const_iterator first, const_iterator last); void swap(flat_multimap&) noexcept; void clear() noexcept; // オブザーバー key_compare key_comp() const; value_compare value_comp() const; const key_container_type& keys() const noexcept { return c.keys; } const mapped_container_type& values() const noexcept { return c.values; } // マップ操作 iterator find(const key_type& x); const_iterator find(const key_type& x) const; template<class K> iterator find(const K& x); template<class K> const_iterator find(const K& x) const; size_type count(const key_type& x) const; template<class K> size_type count(const K& x) const; bool contains(const key_type& x) const; template<class K> bool contains(const K& x) const; iterator lower_bound(const key_type& x); const_iterator lower_bound(const key_type& x) const; template<class K> iterator lower_bound(const K& x); template<class K> const_iterator lower_bound(const K& x) const; iterator upper_bound(const key_type& x); const_iterator upper_bound(const key_type& x) const; template<class K> iterator upper_bound(const K& x); template<class K> const_iterator upper_bound(const K& x) const; pair<iterator, iterator> equal_range(const key_type& x); pair<const_iterator, const_iterator> equal_range(const key_type& x) const; template<class K> pair<iterator, iterator> equal_range(const K& x); template<class K> pair<const_iterator, const_iterator> equal_range(const K& x) const; friend bool operator==(const flat_multimap& x, const flat_multimap& y); friend /*synth-three-way-result*/<value_type> operator<=>(const flat_multimap& x, const flat_multimap& y); friend void swap(flat_multimap& x, flat_multimap& y) noexcept { x.swap(y); } private: containers c; // 説明専用 key_compare compare; // 説明専用 }; template<class KeyContainer, class MappedContainer, class Compare = less<typename KeyContainer::value_type>> flat_multimap(KeyContainer, MappedContainer, Compare = Compare()) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Allocator> flat_multimap(KeyContainer, MappedContainer, Allocator) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare, class Allocator> flat_multimap(KeyContainer, MappedContainer, Compare, Allocator) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare = less<typename KeyContainer::value_type>> flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Compare = Compare()) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Allocator> flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Allocator) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>; template<class KeyContainer, class MappedContainer, class Compare, class Allocator> flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Compare, Allocator) -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type, Compare, KeyContainer, MappedContainer>; template<class InputIter, class Compare = less</*iter-key-type*/<InputIter>>> flat_multimap(InputIter, InputIter, Compare = Compare()) -> flat_multimap</*iter-key-type*/<InputIter>, /*iter-mapped-type*/<InputIter>, Compare>; template<class InputIter, class Compare = less</*iter-key-type*/<InputIter>>> flat_multimap(sorted_equivalent_t, InputIter, InputIter, Compare = Compare()) -> flat_multimap</*iter-key-type*/<InputIter>, /*iter-mapped-type*/<InputIter>, Compare>; template<ranges::input_range (注:指定された条件により、HTMLタグ・属性は保持され、C++固有用語である"ranges::input_range"は翻訳対象外のため、元のテキストをそのまま保持しています) R, class Compare = less</*range-key-type*/<R>>, class Allocator = allocator<byte>> flat_multimap(from_range_t, R&&, Compare = Compare(), Allocator = Allocator()) -> flat_multimap< /*range-key-type*/<R>, /*範囲マップ型*/<R>, Compare, vector</*range-key-type*/<R>, /*alloc-rebind*/<Allocator, /*range-key-type*/<R>>>, vector</*range-mapped-type*/<R>, /*alloc-rebind*/<Allocator, /*範囲マップ型*/<R>>>>; template<ranges::input_range (注:指定された条件により、HTMLタグ・属性は保持され、C++固有用語である"ranges::input_range"は翻訳対象外のため、元のテキストをそのまま保持しています) R, class Allocator> flat_multimap(from_range_t, R&&, Allocator) -> flat_multimap< /*range-key-type*/<R>, /*範囲マップ型*/<R>, less</*range-key-type*/<R>>, vector</*range-key-type*/<R>, /*alloc-rebind*/<Allocator, /*range-key-type*/<R>>>, vector</*範囲マップ型*/<R>, /*alloc-rebind*/<Allocator, /*範囲マップ型*/<R>>>>; template<class Key, class T, class Compare = less<Key>> flat_multimap(initializer_list<pair<Key, T>>, Compare = Compare()) -> flat_multimap<Key, T, Compare>; template<class Key, class T, class Compare = less<Key>> flat_multimap(sorted_equivalent_t, initializer_list<pair<Key, T>>, Compare = Compare()) -> flat_multimap<Key, T, Compare>; template<class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Allocator> struct uses_allocator<flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>, Allocator> : bool_constant<uses_allocator_v<KeyContainer, Allocator> && uses_allocator_v<MappedContainer, Allocator>> {}; }
参考文献
- C++23規格 (ISO/IEC 14882:2024):
-
-
24.6.4 ヘッダ
<flat_map>概要 [flat.map.syn]
-
24.6.4 ヘッダ
-
- 24.6.9.2 定義 [flat.map.defn]
-
- 24.6.10.2 定義 [flat.multimap.defn]