46 template <
typename Key,
typename T,
typename Pr = std::less<Key>,
typename Alloc = std::allocator<std::pair<const Key, T>>>
62 typedef std::map<key_type, value_type, key_compare, typename std::allocator_traits<allocator_type>::template rebind_alloc<std::pair<const key_type, value_type>>>
std_type;
84 iMap{
std::move(aOther.iMap) }
87 map(
const std::initializer_list<value_type>& aIlist)
89 for (
auto& value : aIlist)
90 iMap.emplace(value.first(), value);
96 template <
typename InputIter>
97 map(InputIter aFirst, InputIter aLast) :
109 iMap = std::move(aOther.iMap);
119 constexpr bool operator==(
const self_type& that)
const noexcept
123 constexpr std::partial_ordering
operator<=>(
const self_type& that)
const noexcept
132 void clear() final { iMap.clear(); }
143 using abstract_type::insert;
144 using abstract_type::find;
147 abstract_const_iterator* do_begin(
void* memory)
const final {
return new (memory) container_const_iterator{ iMap.begin() }; }
148 abstract_const_iterator* do_end(
void* memory)
const final {
return new (memory) container_const_iterator{ iMap.end() }; }
149 abstract_iterator* do_begin(
void* memory)
final {
return new (memory) container_iterator{ iMap.begin() }; }
150 abstract_iterator* do_end(
void* memory)
final {
return new (memory) container_iterator{ iMap.end() }; }
151 abstract_iterator* do_erase(
void* memory,
const abstract_const_iterator& aPosition)
final {
return new (memory) container_iterator{ iMap.erase(
static_cast<const container_const_iterator&
>(aPosition)) }; }
152 abstract_iterator* do_erase(
void* memory,
const abstract_const_iterator& aFirst,
const abstract_const_iterator& aLast)
final {
return new (memory) container_iterator{ iMap.erase(
static_cast<const container_const_iterator&
>(aFirst),
static_cast<const container_const_iterator&
>(aLast)) }; }
157 auto existing = iMap.find(aKey);
158 if (existing == iMap.end())
160 existing = iMap.insert(
161 typename std_type::value_type{
162 typename std_type::key_type{aKey},
163 typename std_type::mapped_type{
167 return existing->second.second();
171 return iMap.at(aKey).second();
175 return iMap.at(aKey).second();
179 template <
typename Key2,
typename... Args>
182 auto result = iMap.emplace(std::forward<Key2>(aKey),
183 typename std_type::mapped_type{ aKey,
mapped_type{ std::forward<Args>(aArgs)... } });
184 return result.first->second;
187 abstract_iterator* do_insert(
void* memory,
const abstract_key_type& aKey,
const abstract_mapped_type& aMapped)
final
189 return new (memory) container_iterator{ iMap.insert(
190 typename std_type::value_type{
191 typename std_type::key_type{aKey},
192 typename std_type::mapped_type{
194 mapped_type{aMapped}} }).first };
196 abstract_const_iterator* do_find(
void* memory,
const abstract_key_type& aKey)
const final {
return new (memory) container_const_iterator{ iMap.find(aKey) }; }
197 abstract_iterator* do_find(
void* memory,
const abstract_key_type& aKey)
final {
return new (memory) container_iterator{ iMap.find(aKey) }; }
198 abstract_const_iterator* do_lower_bound(
void* memory,
const abstract_key_type& aKey)
const final {
return new (memory) container_const_iterator{ iMap.lower_bound(aKey) }; }
199 abstract_iterator* do_lower_bound(
void* memory,
const abstract_key_type& aKey)
final {
return new (memory) container_iterator{ iMap.lower_bound(aKey) }; }
200 abstract_const_iterator* do_upper_bound(
void* memory,
const abstract_key_type& aKey)
const final {
return new (memory) container_const_iterator{ iMap.upper_bound(aKey) }; }
201 abstract_iterator* do_upper_bound(
void* memory,
const abstract_key_type& aKey)
final {
return new (memory) container_iterator{ iMap.upper_bound(aKey) }; }
206 template <
typename Key,
typename T,
typename Pr = std::less<Key>,
typename Alloc = std::allocator<std::pair<const Key, T>>>
222 typedef std::multimap<key_type, value_type, key_compare, typename std::allocator_traits<allocator_type>::template rebind_alloc<std::pair<const key_type, value_type>>>
std_type;
244 iMap{
std::move(aOther.iMap) }
247 multimap(
const std::initializer_list<value_type>& aIlist)
249 for (
auto& value : aIlist)
250 iMap.emplace(value.first(), value);
256 template <
typename InputIter>
269 iMap = std::move(aOther.iMap);
279 constexpr bool operator==(
const self_type& that)
const noexcept
281 return as_std_multimap() == that.as_std_multimap();
283 constexpr std::partial_ordering
operator<=>(
const self_type& that)
const noexcept
285 return as_std_multimap() <=> that.as_std_multimap();
292 void clear() final { iMap.clear(); }
303 using abstract_type::insert;
304 using abstract_type::find;
307 abstract_const_iterator* do_begin(
void* memory)
const final {
return new (memory) container_const_iterator{ iMap.begin() }; }
308 abstract_const_iterator* do_end(
void* memory)
const final {
return new (memory) container_const_iterator{ iMap.end() }; }
309 abstract_iterator* do_begin(
void* memory)
final {
return new (memory) container_iterator{ iMap.begin() }; }
310 abstract_iterator* do_end(
void* memory)
final {
return new (memory) container_iterator{ iMap.end() }; }
311 abstract_iterator* do_erase(
void* memory,
const abstract_const_iterator& aPosition)
final {
return new (memory) container_iterator(iMap.erase(
static_cast<const container_const_iterator&
>(aPosition))); }
312 abstract_iterator* do_erase(
void* memory,
const abstract_const_iterator& aFirst,
const abstract_const_iterator& aLast)
final {
return new (memory) container_iterator(iMap.erase(
static_cast<const container_const_iterator&
>(aFirst),
static_cast<const container_const_iterator&
>(aLast))); }
315 template <
typename Key2,
typename... Args>
318 return iMap.emplace(std::forward<Key2>(aKey),
typename std_type::mapped_type{ aKey,
mapped_type{ std::forward<Args>(aArgs)... } })->second;
322 abstract_iterator* do_insert(
void* memory,
const abstract_key_type& aKey,
const abstract_mapped_type& aMapped)
final
324 return new (memory) container_iterator{ iMap.insert(
325 typename std_type::value_type{
326 typename std_type::key_type{aKey},
327 typename std_type::mapped_type{
329 mapped_type{aMapped}} }) };
331 abstract_const_iterator* do_find(
void* memory,
const abstract_key_type& aKey)
const final {
return new (memory) container_const_iterator{ iMap.find(aKey) }; }
332 abstract_iterator* do_find(
void* memory,
const abstract_key_type& aKey)
final {
return new (memory) container_iterator{ iMap.find(aKey) }; }
333 abstract_const_iterator* do_lower_bound(
void* memory,
const abstract_key_type& aKey)
const final {
return new (memory) container_const_iterator{ iMap.lower_bound(aKey) }; }
334 abstract_iterator* do_lower_bound(
void* memory,
const abstract_key_type& aKey)
final {
return new (memory) container_iterator{ iMap.lower_bound(aKey) }; }
335 abstract_const_iterator* do_upper_bound(
void* memory,
const abstract_key_type& aKey)
const final {
return new (memory) container_const_iterator{ iMap.upper_bound(aKey) }; }
336 abstract_iterator* do_upper_bound(
void* memory,
const abstract_key_type& aKey)
final {
return new (memory) container_iterator{ iMap.upper_bound(aKey) }; }
i_container< T, ConstIteratorType, IteratorType > generic_container_type
base_type::const_iterator const_iterator
base_type::abstract_iterator abstract_iterator
base_type::iterator iterator
base_type::abstract_iterator abstract_iterator
base_type::const_iterator const_iterator
base_type::iterator iterator
abstract_mapped_type & at(const abstract_key_type &aKey) final
pair< const key_type, mapped_type > value_type
i_pair< const abstract_key_type, abstract_mapped_type > abstract_value_type
container::const_iterator< value_type, typename std_type::const_iterator > container_const_iterator
container::iterator< value_type, typename std_type::iterator, typename std_type::const_iterator > container_iterator
i_map< abstract_t< Key >, abstract_t< T > > abstract_type
map(InputIter aFirst, InputIter aLast)
map & operator=(const map &aOther)
void assign(const generic_container_type &aOther) final
value_type & emplace(Key2 &&aKey, Args &&... aArgs)
map & operator=(map &&aOther)
abstract_mapped_type & operator[](const abstract_key_type &aKey) final
abstract_t< key_type > abstract_key_type
std::map< key_type, value_type, key_compare, typename std::allocator_traits< allocator_type >::template rebind_alloc< std::pair< const key_type, value_type > > > std_type
map(const std::initializer_list< value_type > &aIlist)
constexpr std::partial_ordering operator<=>(const self_type &that) const noexcept
abstract_type::abstract_const_iterator abstract_const_iterator
size_type max_size() const noexcept final
constexpr bool operator==(const self_type &that) const noexcept
map(const generic_container_type &aOther)
const abstract_mapped_type & at(const abstract_key_type &aKey) const final
abstract_t< mapped_type > abstract_mapped_type
size_type size() const noexcept final
std_type::value_type container_value_type
const std_type & as_std_map() const
abstract_type::abstract_iterator abstract_iterator
std_type to_std_map() const
std_type to_std_multimap() const
std::multimap< key_type, value_type, key_compare, typename std::allocator_traits< allocator_type >::template rebind_alloc< std::pair< const key_type, value_type > > > std_type
constexpr bool operator==(const self_type &that) const noexcept
void assign(const generic_container_type &aOther) final
multimap(const multimap &aOther)
multimap & operator=(multimap &&aOther)
i_multimap< abstract_t< Key >, abstract_t< T > > abstract_type
pair< const key_type, mapped_type > value_type
i_pair< const abstract_key_type, abstract_mapped_type > abstract_value_type
abstract_type::abstract_iterator abstract_iterator
value_type & emplace(Key2 &&aKey, Args &&... aArgs)
container::const_iterator< value_type, typename std_type::const_iterator > container_const_iterator
multimap(InputIter aFirst, InputIter aLast)
size_type max_size() const noexcept final
abstract_t< mapped_type > abstract_mapped_type
std_type::value_type container_value_type
container::iterator< value_type, typename std_type::iterator, typename std_type::const_iterator > container_iterator
multimap(multimap &&aOther)
std_type & as_std_multimap()
abstract_t< key_type > abstract_key_type
multimap(const std::initializer_list< value_type > &aIlist)
multimap & operator=(const multimap &aOther)
constexpr std::partial_ordering operator<=>(const self_type &that) const noexcept
abstract_type::abstract_const_iterator abstract_const_iterator
const std_type & as_std_multimap() const
multimap(const generic_container_type &aOther)
size_type size() const noexcept final
typename detail::abstract_type< T >::type abstract_t