momo  3.11
set.h
Go to the documentation of this file.
1 /**********************************************************\
2 
3  This file is part of the
4  https://github.com/morzhovets/momo
5  project, distributed under the MIT License. See
6  https://github.com/morzhovets/momo/blob/branch_cpp11/LICENSE
7  for details.
8 
9  momo/stdish/set.h
10 
11  namespace momo::stdish:
12  class set
13  class multiset
14 
15 \**********************************************************/
16 
17 #ifndef MOMO_INCLUDE_GUARD_STDISH_SET
18 #define MOMO_INCLUDE_GUARD_STDISH_SET
19 
20 #ifdef __has_include
21 # if __has_include(<momo/Utility.h>)
22 # include <momo/Utility.h>
23 # endif
24 #endif
25 #ifndef MOMO_PARENT_HEADER
26 # include "../Utility.h"
27 #endif
28 
29 #include MOMO_PARENT_HEADER(TreeSet)
30 #include "set_map_utility.h"
31 
32 namespace momo
33 {
34 
35 namespace stdish
36 {
37 
62 template<typename TKey,
63  typename TLessComparer = std::less<TKey>,
64  typename TAllocator = std::allocator<TKey>,
65  typename TTreeSet = TreeSet<TKey, TreeTraitsStd<TKey, TLessComparer>, MemManagerStd<TAllocator>>>
66 class set
67 {
68 private:
69  typedef TTreeSet TreeSet;
70  typedef typename TreeSet::TreeTraits TreeTraits;
71  typedef typename TreeSet::MemManager MemManager;
72 
73 public:
74  typedef TKey key_type;
75  typedef TLessComparer key_compare;
76  typedef TAllocator allocator_type;
77 
78  typedef TreeSet nested_container_type;
79 
80  typedef size_t size_type;
81  typedef ptrdiff_t difference_type;
82 
85 
87  typedef typename TreeSet::Iterator iterator;
88 
89  //typedef typename iterator::Reference reference;
92 
93  //typedef typename iterator::Pointer pointer;
94  typedef value_type* pointer;
96  //typedef typename std::allocator_traits<allocator_type>::pointer pointer;
97  //typedef typename std::allocator_traits<allocator_type>::const_pointer const_pointer;
98 
99  typedef std::reverse_iterator<iterator> reverse_iterator;
100  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
101 
104 
105 private:
106  template<typename KeyArg>
107  struct IsValidKeyArg : public TreeTraits::template IsValidKeyArg<KeyArg>
108  {
109  };
110 
111  struct NodeTypeProxy : private node_type
112  {
113  typedef node_type NodeType;
114  MOMO_DECLARE_PROXY_FUNCTION(NodeType, GetExtractedItem)
115  };
116 
117 public:
118  set()
119  {
120  }
121 
122  explicit set(const allocator_type& alloc)
123  : mTreeSet(TreeTraits(), MemManager(alloc))
124  {
125  }
126 
127  explicit set(const key_compare& lessComp, const allocator_type& alloc = allocator_type())
128  : mTreeSet(TreeTraits(lessComp), MemManager(alloc))
129  {
130  }
131 
132  template<typename Iterator>
133  set(Iterator first, Iterator last, const allocator_type& alloc = allocator_type())
134  : set(alloc)
135  {
136  insert(first, last);
137  }
138 
139  template<typename Iterator>
140  set(Iterator first, Iterator last, const key_compare& lessComp,
141  const allocator_type& alloc = allocator_type())
142  : set(lessComp, alloc)
143  {
144  insert(first, last);
145  }
146 
147  set(std::initializer_list<momo::internal::Identity<value_type>> values,
148  const allocator_type& alloc = allocator_type())
149  : mTreeSet(values, TreeTraits(), MemManager(alloc))
150  {
151  }
152 
153  set(std::initializer_list<momo::internal::Identity<value_type>> values,
154  const key_compare& lessComp, const allocator_type& alloc = allocator_type())
155  : mTreeSet(values, TreeTraits(lessComp), MemManager(alloc))
156  {
157  }
158 
159 #ifdef MOMO_HAS_CONTAINERS_RANGES
160  template<std::ranges::input_range Range>
161  requires std::convertible_to<std::ranges::range_reference_t<Range>, value_type>
162  set(std::from_range_t, Range&& values, const allocator_type& alloc = allocator_type())
163  : set(alloc)
164  {
165  insert_range(std::forward<Range>(values));
166  }
167 
168  template<std::ranges::input_range Range>
169  requires std::convertible_to<std::ranges::range_reference_t<Range>, value_type>
170  set(std::from_range_t, Range&& values, const key_compare& lessComp,
171  const allocator_type& alloc = allocator_type())
172  : set(lessComp, alloc)
173  {
174  insert_range(std::forward<Range>(values));
175  }
176 #endif // MOMO_HAS_CONTAINERS_RANGES
177 
178  set(set&& right)
179  : set(std::move(right), right.get_allocator())
180  {
181  }
182 
184  : mTreeSet(right.mTreeSet.GetTreeTraits(), MemManager(alloc))
185  {
186  if (right.get_allocator() == alloc)
187  {
188  mTreeSet.Swap(right.mTreeSet);
189  }
190  else
191  {
192  mTreeSet.MergeFrom(right.mTreeSet);
193  right.clear();
194  }
195  }
196 
197  set(const set& right)
198  : mTreeSet(right.mTreeSet)
199  {
200  }
201 
203  : mTreeSet(right.mTreeSet, MemManager(alloc))
204  {
205  }
206 
207  ~set() = default;
208 
209  set& operator=(set&& right)
211  {
212  return momo::internal::ContainerAssignerStd::Move(std::move(right), *this);
213  }
214 
215  set& operator=(const set& right)
216  {
217  return momo::internal::ContainerAssignerStd::Copy(right, *this);
218  }
219 
220  set& operator=(std::initializer_list<value_type> values)
221  {
222  mTreeSet = TreeSet(values, mTreeSet.GetTreeTraits(), MemManager(get_allocator()));
223  return *this;
224  }
225 
226  void swap(set& right) noexcept
227  {
229  }
230 
231  friend void swap(set& left, set& right) noexcept
232  {
233  left.swap(right);
234  }
235 
237  {
238  return mTreeSet;
239  }
240 
242  {
243  return mTreeSet;
244  }
245 
246  const_iterator begin() const noexcept
247  {
248  return mTreeSet.GetBegin();
249  }
250 
251  //iterator begin() noexcept
252 
253  const_iterator end() const noexcept
254  {
255  return mTreeSet.GetEnd();
256  }
257 
258  //iterator end() noexcept
259 
261  {
262  return const_reverse_iterator(end());
263  }
264 
265  //reverse_iterator rbegin() noexcept
266 
267  const_reverse_iterator rend() const noexcept
268  {
269  return const_reverse_iterator(begin());
270  }
271 
272  //reverse_iterator rend() noexcept
273 
274  const_iterator cbegin() const noexcept
275  {
276  return begin();
277  }
278 
279  const_iterator cend() const noexcept
280  {
281  return end();
282  }
283 
285  {
286  return rbegin();
287  }
288 
289  const_reverse_iterator crend() const noexcept
290  {
291  return rend();
292  }
293 
295  {
296  return mTreeSet.GetTreeTraits().GetLessComparer();
297  }
298 
300  {
301  return key_comp();
302  }
303 
304  allocator_type get_allocator() const noexcept
305  {
306  return allocator_type(mTreeSet.GetMemManager().GetByteAllocator());
307  }
308 
309  size_type max_size() const noexcept
310  {
311  return std::allocator_traits<allocator_type>::max_size(get_allocator());
312  }
313 
314  size_type size() const noexcept
315  {
316  return mTreeSet.GetCount();
317  }
318 
319  MOMO_NODISCARD bool empty() const noexcept
320  {
321  return mTreeSet.IsEmpty();
322  }
323 
324  void clear() noexcept
325  {
326  mTreeSet.Clear();
327  }
328 
329  const_iterator find(const key_type& key) const
330  {
331  return mTreeSet.Find(key);
332  }
333 
334  //iterator find(const key_type& key)
335 
336  template<typename KeyArg>
338  const_iterator> find(const KeyArg& key) const
339  {
340  return mTreeSet.Find(key);
341  }
342 
343  //template<typename KeyArg>
344  //momo::internal::EnableIf<IsValidKeyArg<KeyArg>::value,
345  //iterator> find(const KeyArg& key)
346 
347  size_type count(const key_type& key) const
348  {
349  return mTreeSet.GetKeyCount(key);
350  }
351 
352  template<typename KeyArg>
354  size_type> count(const KeyArg& key) const
355  {
356  return mTreeSet.GetKeyCount(key);
357  }
358 
359  bool contains(const key_type& key) const
360  {
361  return mTreeSet.ContainsKey(key);
362  }
363 
364  template<typename KeyArg>
366  bool> contains(const KeyArg& key) const
367  {
368  return mTreeSet.ContainsKey(key);
369  }
370 
372  {
373  return mTreeSet.GetLowerBound(key);
374  }
375 
376  //iterator lower_bound(const key_type& key)
377 
378  template<typename KeyArg>
380  const_iterator> lower_bound(const KeyArg& key) const
381  {
382  return mTreeSet.GetLowerBound(key);
383  }
384 
385  //template<typename KeyArg>
386  //momo::internal::EnableIf<IsValidKeyArg<KeyArg>::value,
387  //iterator> lower_bound(const KeyArg& key)
388 
390  {
391  return mTreeSet.GetUpperBound(key);
392  }
393 
394  //iterator upper_bound(const key_type& key)
395 
396  template<typename KeyArg>
398  const_iterator> upper_bound(const KeyArg& key) const
399  {
400  return mTreeSet.GetUpperBound(key);
401  }
402 
403  //template<typename KeyArg>
404  //momo::internal::EnableIf<IsValidKeyArg<KeyArg>::value,
405  //iterator> upper_bound(const KeyArg& key)
406 
407  std::pair<const_iterator, const_iterator> equal_range(const key_type& key) const
408  {
409  const_iterator iter = lower_bound(key);
411  return { iter, upper_bound(key) };
412  if (iter == end() || mTreeSet.GetTreeTraits().IsLess(key, *iter))
413  return { iter, iter };
414  return { iter, std::next(iter) };
415  }
416 
417  //std::pair<iterator, iterator> equal_range(const key_type& key)
418 
419  template<typename KeyArg>
421  std::pair<const_iterator, const_iterator>> equal_range(const KeyArg& key) const
422  {
423  return { lower_bound(key), upper_bound(key) };
424  }
425 
426  //template<typename KeyArg>
427  //momo::internal::EnableIf<IsValidKeyArg<KeyArg>::value,
428  //std::pair<iterator, iterator>> equal_range(const KeyArg& key)
429 
430  std::pair<iterator, bool> insert(value_type&& value)
431  {
432  typename TreeSet::InsertResult res = mTreeSet.Insert(std::move(value));
433  return { res.position, res.inserted };
434  }
435 
437  {
438  if (!pvCheckHint(hint, static_cast<const key_type&>(value)))
439  return insert(std::move(value)).first;
440  return mTreeSet.Add(hint, std::move(value));
441  }
442 
443  std::pair<iterator, bool> insert(const value_type& value)
444  {
445  typename TreeSet::InsertResult res = mTreeSet.Insert(value);
446  return { res.position, res.inserted };
447  }
448 
450  {
451  if (!pvCheckHint(hint, value))
452  return insert(value).first;
453  return mTreeSet.Add(hint, value);
454  }
455 
457  {
458  if (node.empty())
459  return { end(), false, node_type() };
460  typename TreeSet::InsertResult res = mTreeSet.Insert(
461  std::move(NodeTypeProxy::GetExtractedItem(node)));
462  return { res.position, res.inserted, res.inserted ? node_type() : std::move(node) };
463  }
464 
466  {
467  if (node.empty())
468  return end();
469  if (!pvCheckHint(hint, node.value()))
470  return insert(std::move(node)).position;
471  return mTreeSet.Add(hint, std::move(NodeTypeProxy::GetExtractedItem(node)));
472  }
473 
474  template<typename Iterator>
475  void insert(Iterator first, Iterator last)
476  {
477  pvInsertRange(first, last);
478  }
479 
480  void insert(std::initializer_list<value_type> values)
481  {
482  mTreeSet.Insert(values);
483  }
484 
485 #ifdef MOMO_HAS_CONTAINERS_RANGES
486  template<std::ranges::input_range Range>
487  requires std::convertible_to<std::ranges::range_reference_t<Range>, value_type>
488  void insert_range(Range&& values)
489  {
490  pvInsertRange(std::ranges::begin(values), std::ranges::end(values));
491  }
492 #endif // MOMO_HAS_CONTAINERS_RANGES
493 
494  template<typename... ValueArgs>
495  std::pair<iterator, bool> emplace(ValueArgs&&... valueArgs)
496  {
497  MemManager& memManager = mTreeSet.GetMemManager();
498  typename TreeSet::ExtractedItem extItem;
499  typedef typename TreeSet::ItemTraits::template Creator<ValueArgs...> ValueCreator;
500  extItem.Create(ValueCreator(memManager, std::forward<ValueArgs>(valueArgs)...));
501  typename TreeSet::InsertResult res = mTreeSet.Insert(std::move(extItem));
502  return { res.position, res.inserted };
503  }
504 
505  template<typename ValueArg>
507  std::pair<iterator, bool>> emplace(ValueArg&& valueArg)
508  {
509  typename TreeSet::InsertResult res = mTreeSet.InsertVar(
510  static_cast<const key_type&>(valueArg), std::forward<ValueArg>(valueArg));
511  return { res.position, res.inserted };
512  }
513 
514  template<typename... ValueArgs>
515  iterator emplace_hint(const_iterator hint, ValueArgs&&... valueArgs)
516  {
517  MemManager& memManager = mTreeSet.GetMemManager();
518  typename TreeSet::ExtractedItem extItem;
519  typedef typename TreeSet::ItemTraits::template Creator<ValueArgs...> ValueCreator;
520  extItem.Create(ValueCreator(memManager, std::forward<ValueArgs>(valueArgs)...));
521  if (!pvCheckHint(hint, extItem.GetItem()))
522  return mTreeSet.Insert(std::move(extItem)).position;
523  return mTreeSet.Add(hint, std::move(extItem));
524  }
525 
526  template<typename ValueArg>
528  iterator> emplace_hint(const_iterator hint, ValueArg&& valueArg)
529  {
530  if (!pvCheckHint(hint, static_cast<const key_type&>(valueArg)))
531  return emplace(std::forward<ValueArg>(valueArg)).first;
532  return mTreeSet.AddVar(hint, std::forward<ValueArg>(valueArg));
533  }
534 
536  {
537  return mTreeSet.Remove(where);
538  }
539 
540  //iterator erase(iterator where)
541 
543  {
544  return mTreeSet.Remove(first, last);
545  }
546 
548  {
549  return mTreeSet.Remove(key);
550  }
551 
552  template<typename ValueFilter>
553  friend size_type erase_if(set& cont, const ValueFilter& valueFilter)
554  {
555  return cont.mTreeSet.Remove(valueFilter);
556  }
557 
559  {
560  return node_type(*this, where); // need RVO for exception safety
561  }
562 
564  {
565  const_iterator iter = find(key);
566  return (iter != end()) ? extract(iter) : node_type();
567  }
568 
569  template<typename Set>
570  void merge(Set&& set)
571  {
572  mTreeSet.MergeFrom(set.get_nested_container());
573  }
574 
575  friend bool operator==(const set& left, const set& right)
576  {
577  return left.size() == right.size() && std::equal(left.begin(), left.end(), right.begin());
578  }
579 
580 #ifdef MOMO_HAS_THREE_WAY_COMPARISON
581  friend auto operator<=>(const set& left, const set& right)
582  requires requires (const_reference ref) { std::tie(ref) <=> std::tie(ref); }
583  {
584  auto valueThreeComp = [] (const value_type& value1, const value_type& value2)
585  { return std::tie(value1) <=> std::tie(value2); };
586  return std::lexicographical_compare_three_way(left.begin(), left.end(),
587  right.begin(), right.end(), valueThreeComp);
588  }
589 #else
590  friend bool operator<(const set& left, const set& right)
591  {
592  return std::lexicographical_compare(left.begin(), left.end(), right.begin(), right.end());
593  }
594 #endif
595 
597 
598 private:
599  bool pvIsOrdered(const key_type& key1, const key_type& key2) const
600  {
601  const TreeTraits& treeTraits = mTreeSet.GetTreeTraits();
602  return TreeTraits::multiKey ? !treeTraits.IsLess(key2, key1)
603  : treeTraits.IsLess(key1, key2);
604  }
605 
606  bool pvCheckHint(const_iterator& hint, const key_type& key) const
607  {
608  if (hint != begin() && !pvIsOrdered(*std::prev(hint), key))
609  return false;
610  if (hint != end() && !pvIsOrdered(key, *hint))
611  {
613  hint = lower_bound(key);
614  return TreeTraits::multiKey;
615  }
616  return true;
617  }
618 
619  template<typename Iterator, typename Sentinel>
621  void> pvInsertRange(Iterator begin, Sentinel end)
622  {
623  mTreeSet.Insert(std::move(begin), std::move(end));
624  }
625 
626  template<typename Iterator, typename Sentinel>
628  void> pvInsertRange(Iterator begin, Sentinel end)
629  {
630  for (Iterator iter = std::move(begin); iter != end; ++iter)
631  emplace(*iter);
632  }
633 
634 private:
635  TreeSet mTreeSet;
636 };
637 
646 template<typename TKey,
647  typename TLessComparer = std::less<TKey>,
648  typename TAllocator = std::allocator<TKey>,
649  typename TTreeSet = TreeSet<TKey, TreeTraitsStd<TKey, TLessComparer, true>,
650  MemManagerStd<TAllocator>>>
651 class multiset : public set<TKey, TLessComparer, TAllocator, TTreeSet>
652 {
653 private:
655 
656 public:
657  using typename Set::size_type;
658  using typename Set::value_type;
659  using typename Set::iterator;
660  using typename Set::node_type;
661 
663 
664 public:
665  using Set::Set;
666 
667  multiset& operator=(std::initializer_list<value_type> values)
668  {
669  Set::operator=(values);
670  return *this;
671  }
672 
673  friend void swap(multiset& left, multiset& right) noexcept
674  {
675  left.swap(right);
676  }
677 
678  using Set::insert;
679 
681  {
682  return Set::insert(std::move(value)).first;
683  }
684 
685  iterator insert(const value_type& value)
686  {
687  return Set::insert(value).first;
688  }
689 
691  {
692  return Set::insert(std::move(node)).position;
693  }
694 
695  template<typename... ValueArgs>
696  iterator emplace(ValueArgs&&... valueArgs)
697  {
698  return Set::emplace(std::forward<ValueArgs>(valueArgs)...).first;
699  }
700 
701  template<typename ValueFilter>
702  friend size_type erase_if(multiset& cont, const ValueFilter& valueFilter)
703  {
704  return cont.get_nested_container().Remove(valueFilter);
705  }
706 };
707 
708 #ifdef MOMO_HAS_DEDUCTION_GUIDES
709 
710 #define MOMO_DECLARE_DEDUCTION_GUIDES(set) \
711 template<typename Iterator, \
712  typename Key = typename std::iterator_traits<Iterator>::value_type, \
713  typename Allocator = std::allocator<Key>, \
714  typename = internal::ordered_checker<Key, Allocator>> \
715 set(Iterator, Iterator, Allocator = Allocator()) \
716  -> set<Key, std::less<Key>, Allocator>; \
717 template<typename Iterator, typename LessComparer, \
718  typename Key = typename std::iterator_traits<Iterator>::value_type, \
719  typename Allocator = std::allocator<Key>, \
720  typename = internal::ordered_checker<Key, Allocator, LessComparer>> \
721 set(Iterator, Iterator, LessComparer, Allocator = Allocator()) \
722  -> set<Key, LessComparer, Allocator>; \
723 template<typename Key, \
724  typename Allocator = std::allocator<Key>, \
725  typename = internal::ordered_checker<Key, Allocator>> \
726 set(std::initializer_list<Key>, Allocator = Allocator()) \
727  -> set<Key, std::less<Key>, Allocator>; \
728 template<typename Key, typename LessComparer, \
729  typename Allocator = std::allocator<Key>, \
730  typename = internal::ordered_checker<Key, Allocator, LessComparer>> \
731 set(std::initializer_list<Key>, LessComparer, Allocator = Allocator()) \
732  -> set<Key, LessComparer, Allocator>;
733 
734 MOMO_DECLARE_DEDUCTION_GUIDES(set)
735 MOMO_DECLARE_DEDUCTION_GUIDES(multiset)
736 
737 #undef MOMO_DECLARE_DEDUCTION_GUIDES
738 
739 #ifdef MOMO_HAS_CONTAINERS_RANGES
740 
741 #define MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(set) \
742 template<std::ranges::input_range Range, \
743  typename Key = std::ranges::range_value_t<Range>, \
744  typename Allocator = std::allocator<Key>, \
745  typename = internal::ordered_checker<Key, Allocator>> \
746 set(std::from_range_t, Range&&, Allocator = Allocator()) \
747  -> set<Key, std::less<Key>, Allocator>; \
748 template<std::ranges::input_range Range, typename LessComparer, \
749  typename Key = std::ranges::range_value_t<Range>, \
750  typename Allocator = std::allocator<Key>, \
751  typename = internal::ordered_checker<Key, Allocator, LessComparer>> \
752 set(std::from_range_t, Range&&, LessComparer, Allocator = Allocator()) \
753  -> set<Key, LessComparer, Allocator>;
754 
755 MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(set)
756 MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(multiset)
757 
758 #undef MOMO_DECLARE_DEDUCTION_GUIDES_RANGES
759 
760 #endif // MOMO_HAS_CONTAINERS_RANGES
761 
762 #endif // MOMO_HAS_DEDUCTION_GUIDES
763 
764 } // namespace stdish
765 
766 } // namespace momo
767 
768 #endif // MOMO_INCLUDE_GUARD_STDISH_SET
momo::stdish::set::crend
const_reverse_iterator crend() const noexcept
Definition: set.h:289
momo::internal::InsertResult::position
Position position
Definition: IteratorUtility.h:168
momo::stdish::set::extract
node_type extract(const_iterator where)
Definition: set.h:558
momo::stdish::set::const_iterator
TreeSet::ConstIterator const_iterator
Definition: set.h:86
momo::internal::TreeSetConstIterator::Pointer
const Item * Pointer
Definition: TreeSet.h:41
momo::stdish::set::find
momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, const_iterator > find(const KeyArg &key) const
Definition: set.h:338
momo::stdish::set::swap
void swap(set &right) noexcept
Definition: set.h:226
momo::TreeTraits::IsLess
bool IsLess(const KeyArg1 &key1, const KeyArg2 &key2) const
Definition: TreeTraits.h:107
momo::stdish::set::difference_type
ptrdiff_t difference_type
Definition: set.h:81
momo::internal::TreeSetConstIterator::Reference
const Item & Reference
Definition: TreeSet.h:40
momo::stdish::set::const_pointer
const_iterator::Pointer const_pointer
Definition: set.h:95
momo::stdish::set::get_nested_container
const nested_container_type & get_nested_container() const noexcept
Definition: set.h:236
momo::stdish::set::rbegin
const_reverse_iterator rbegin() const noexcept
Definition: set.h:260
momo::stdish::set::value_compare
key_compare value_compare
Definition: set.h:84
set_map_utility.h
momo::stdish::set::~set
~set()=default
momo::stdish::internal::insert_return_type
Definition: set_map_utility.h:202
momo::stdish::set::upper_bound
momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, const_iterator > upper_bound(const KeyArg &key) const
Definition: set.h:398
momo::stdish::set::size
size_type size() const noexcept
Definition: set.h:314
momo::stdish::set::key_type
TKey key_type
Definition: set.h:74
momo::stdish::set::allocator_type
TAllocator allocator_type
Definition: set.h:76
momo::stdish::multiset::emplace
iterator emplace(ValueArgs &&... valueArgs)
Definition: set.h:696
momo::stdish::multiset::value_type
key_type value_type
Definition: set.h:83
momo::stdish::set::set
set(Iterator first, Iterator last, const key_compare &lessComp, const allocator_type &alloc=allocator_type())
Definition: set.h:140
momo::stdish::set::set
set(Iterator first, Iterator last, const allocator_type &alloc=allocator_type())
Definition: set.h:133
momo::stdish::set::nested_container_type
TreeSet nested_container_type
Definition: set.h:78
momo::stdish::set::contains
momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, bool > contains(const KeyArg &key) const
Definition: set.h:366
momo::stdish::set::get_nested_container
nested_container_type & get_nested_container() noexcept
Definition: set.h:241
momo::stdish::set::set
set(set &&right, const momo::internal::Identity< allocator_type > &alloc)
Definition: set.h:183
momo::stdish::set::key_comp
key_compare key_comp() const
Definition: set.h:294
momo::stdish::set
momo::stdish::set is similar to std::set, but much more efficient in memory usage....
Definition: set.h:67
momo::stdish::set::cend
const_iterator cend() const noexcept
Definition: set.h:279
momo::TreeTraits
Definition: TreeTraits.h:82
momo::stdish::set::find
const_iterator find(const key_type &key) const
Definition: set.h:329
momo::stdish::set::rend
const_reverse_iterator rend() const noexcept
Definition: set.h:267
momo::stdish::set::equal_range
momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, std::pair< const_iterator, const_iterator > > equal_range(const KeyArg &key) const
Definition: set.h:421
momo::internal::SetExtractedItem::GetItem
const Item & GetItem() const
Definition: SetUtility.h:308
momo::stdish::set::clear
void clear() noexcept
Definition: set.h:324
momo::stdish::set::get_allocator
allocator_type get_allocator() const noexcept
Definition: set.h:304
momo::stdish::set::end
const_iterator end() const noexcept
Definition: set.h:253
momo::stdish::set::count
size_type count(const key_type &key) const
Definition: set.h:347
momo::internal::ContainerAssignerStd::Move
static Container & Move(Container &&srcCont, Container &dstCont) noexcept(IsNothrowMoveAssignable< Container >::value)
Definition: Utility.h:496
momo::stdish::set::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: set.h:100
momo::internal::InsertResult
Definition: IteratorUtility.h:136
momo::stdish::multiset
momo::stdish::multiset is similar to std::multiset, but much more efficient in memory usage....
Definition: set.h:652
momo::stdish::multiset::insert
iterator insert(node_type &&node)
Definition: set.h:690
momo::stdish::set::set
set(const set &right)
Definition: set.h:197
momo::stdish::set::operator=
set & operator=(set &&right) noexcept(momo::internal::ContainerAssignerStd::IsNothrowMoveAssignable< set >::value)
Definition: set.h:209
momo::stdish::multiset::erase_if
friend size_type erase_if(multiset &cont, const ValueFilter &valueFilter)
Definition: set.h:702
momo::stdish::multiset::size_type
size_t size_type
Definition: set.h:80
momo::internal::EnableIf
typename std::enable_if< value, Type >::type EnableIf
Definition: Utility.h:209
momo::stdish::set::crbegin
const_reverse_iterator crbegin() const noexcept
Definition: set.h:284
momo::stdish::set::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: set.h:99
momo::stdish::set::lower_bound
const_iterator lower_bound(const key_type &key) const
Definition: set.h:371
momo::stdish::set::set
set(set &&right)
Definition: set.h:178
momo
Definition: Array.h:26
momo::stdish::multiset::swap
friend void swap(multiset &left, multiset &right) noexcept
Definition: set.h:673
momo::internal::ContainerAssignerStd::IsNothrowMoveAssignable
BoolConstant< std::is_empty< Allocator >::value||std::allocator_traits< Allocator >::propagate_on_container_move_assignment::value > IsNothrowMoveAssignable
Definition: Utility.h:492
momo::stdish::set::set
set(const set &right, const momo::internal::Identity< allocator_type > &alloc)
Definition: set.h:202
momo::stdish::set::operator=
set & operator=(const set &right)
Definition: set.h:215
MOMO_MORE_COMPARISON_OPERATORS
#define MOMO_MORE_COMPARISON_OPERATORS(RObject)
Definition: Utility.h:88
momo::stdish::set::erase
iterator erase(const_iterator first, const_iterator last)
Definition: set.h:542
momo::stdish::set::cbegin
const_iterator cbegin() const noexcept
Definition: set.h:274
momo::internal::InsertResult::inserted
bool inserted
Definition: IteratorUtility.h:171
momo::internal::Identity
EnableIf< true, Type > Identity
Definition: Utility.h:212
momo::stdish::multiset::insert
iterator insert(value_type &&value)
Definition: set.h:680
momo::stdish::set::const_reference
const_iterator::Reference const_reference
Definition: set.h:91
momo::stdish::set::value_comp
value_compare value_comp() const
Definition: set.h:299
momo::stdish::set::equal_range
std::pair< const_iterator, const_iterator > equal_range(const key_type &key) const
Definition: set.h:407
momo::stdish::set::pointer
value_type * pointer
Definition: set.h:94
momo::stdish::set::iterator
TreeSet::Iterator iterator
Definition: set.h:87
momo::stdish::set::empty
MOMO_NODISCARD bool empty() const noexcept
Definition: set.h:319
momo::stdish::set::set
set(const allocator_type &alloc)
Definition: set.h:122
momo::stdish::set::max_size
size_type max_size() const noexcept
Definition: set.h:309
momo::stdish::set::emplace_hint
iterator emplace_hint(const_iterator hint, ValueArgs &&... valueArgs)
Definition: set.h:515
momo::stdish::set::emplace_hint
momo::internal::EnableIf< std::is_same< key_type, typename std::decay< ValueArg >::type >::value, iterator > emplace_hint(const_iterator hint, ValueArg &&valueArg)
Definition: set.h:528
momo::stdish::set::contains
bool contains(const key_type &key) const
Definition: set.h:359
MOMO_DECLARE_PROXY_FUNCTION
#define MOMO_DECLARE_PROXY_FUNCTION(Object, Func)
Definition: Utility.h:126
momo::stdish::set::reference
value_type & reference
Definition: set.h:90
momo::stdish::set::insert
std::pair< iterator, bool > insert(value_type &&value)
Definition: set.h:430
momo::stdish::multiset::insert_return_type
iterator insert_return_type
Definition: set.h:662
momo::stdish::set::merge
void merge(Set &&set)
Definition: set.h:570
std
Definition: Array.h:1173
momo::stdish::multiset::operator=
multiset & operator=(std::initializer_list< value_type > values)
Definition: set.h:667
momo::stdish::set::operator=
set & operator=(std::initializer_list< value_type > values)
Definition: set.h:220
momo::stdish::set::count
momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, size_type > count(const KeyArg &key) const
Definition: set.h:354
momo::internal::SetExtractedItem::Create
void Create(ItemCreator &&itemCreator)
Definition: SetUtility.h:321
momo::stdish::set::emplace
momo::internal::EnableIf< std::is_same< key_type, typename std::decay< ValueArg >::type >::value, std::pair< iterator, bool > > emplace(ValueArg &&valueArg)
Definition: set.h:507
momo::stdish::set::set
set(const key_compare &lessComp, const allocator_type &alloc=allocator_type())
Definition: set.h:127
momo::stdish::set::operator<
friend bool operator<(const set &left, const set &right)
Definition: set.h:590
momo::stdish::set::emplace
std::pair< iterator, bool > emplace(ValueArgs &&... valueArgs)
Definition: set.h:495
momo::stdish::set::erase
size_type erase(const key_type &key)
Definition: set.h:547
momo::stdish::set::swap
friend void swap(set &left, set &right) noexcept
Definition: set.h:231
momo::stdish::internal::set_node_handle
Definition: set_map_utility.h:42
momo::stdish::set::size_type
size_t size_type
Definition: set.h:80
momo::TreeSet::MemManager
TMemManager MemManager
Definition: TreeSet.h:300
momo::stdish::set::operator==
friend bool operator==(const set &left, const set &right)
Definition: set.h:575
momo::stdish::set::lower_bound
momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, const_iterator > lower_bound(const KeyArg &key) const
Definition: set.h:380
momo::stdish::set::erase
iterator erase(const_iterator where)
Definition: set.h:535
momo::internal::TreeSetConstIterator
Definition: TreeSet.h:33
momo::internal::ContainerAssignerStd::Copy
static Container & Copy(const Container &srcCont, Container &dstCont)
Definition: Utility.h:512
momo::stdish::set::set
set(std::initializer_list< momo::internal::Identity< value_type >> values, const allocator_type &alloc=allocator_type())
Definition: set.h:147
momo::stdish::set::extract
node_type extract(const key_type &key)
Definition: set.h:563
momo::stdish::multiset::insert
iterator insert(const value_type &value)
Definition: set.h:685
momo::stdish::set::upper_bound
const_iterator upper_bound(const key_type &key) const
Definition: set.h:389
momo::stdish::set::erase_if
friend size_type erase_if(set &cont, const ValueFilter &valueFilter)
Definition: set.h:553
Utility.h
momo::TreeTraits::multiKey
static const bool multiKey
Definition: TreeTraits.h:87
momo::stdish::set::begin
const_iterator begin() const noexcept
Definition: set.h:246
momo::stdish::set::insert_return_type
internal::insert_return_type< iterator, node_type > insert_return_type
Definition: set.h:103
momo::stdish::set::set
set(std::initializer_list< momo::internal::Identity< value_type >> values, const key_compare &lessComp, const allocator_type &alloc=allocator_type())
Definition: set.h:153
momo::stdish::set::node_type
internal::set_node_handle< typename TreeSet::ExtractedItem > node_type
Definition: set.h:102
momo::internal::SetExtractedItem
Definition: SetUtility.h:256
momo::internal::ContainerAssignerStd::Swap
static void Swap(Container &cont1, Container &cont2) noexcept
Definition: Utility.h:527
momo::stdish::set::key_compare
TLessComparer key_compare
Definition: set.h:75
MOMO_NODISCARD
#define MOMO_NODISCARD
Definition: UserSettings.h:217
momo::stdish::set::set
set()
Definition: set.h:118
momo::stdish::set::value_type
key_type value_type
Definition: set.h:83
momo::TreeSet::TreeTraits
TTreeTraits TreeTraits
Definition: TreeSet.h:299