MorphoGraphX  2.0-1-227
SetVector.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef UTIL_SET_VECTOR_H
12 #define UTIL_SET_VECTOR_H
13 
14 #include <Config.hpp>
15 
16 #include <algorithm>
17 #include <functional>
18 #include <vector>
19 
20 #ifdef USE_CXX11
21 # include <initializer_list>
22 # define NOEXCEPT noexcept
23 # define STD_FORWARD(T, V) std::forward<T>(V)
24 #else
25 # define NOEXCEPT
26 # define STD_FORWARD(T, V) (V)
27 #endif
28 
29 namespace mgx
30 {
36  template <typename Key, typename Compare = std::less<Key>, class Allocator = std::allocator<Key> >
38  typedef std::vector<Key, Allocator> content_t;
39  content_t _content;
40  Compare _compare;
41 
42  public:
43  typedef Key key_type;
44  typedef Key value_type;
45  typedef Compare key_compare;
46  typedef Compare value_compare;
47  typedef Allocator allocator_type;
49  typedef const value_type& const_reference;
50 
51  #ifdef USE_CXX11
53  typedef typename std::allocator_traits<allocator_type>::const_pointer const_pointer;
54  #else
55  typedef typename allocator_type::pointer pointer;
56  typedef typename allocator_type::const_pointer const_pointer;
57  #endif
58 
59  typedef typename content_t::const_iterator iterator;
60  typedef typename content_t::const_iterator const_iterator;
61  typedef typename content_t::size_type size_type;
62  typedef typename content_t::difference_type difference_type;
63 
64  typedef std::reverse_iterator<iterator> reverse_iterator;
65  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
66 
68  explicit multiset_vector(const Compare& comp = Compare(), const Allocator& alloc = Allocator())
70  : _content(alloc)
71  , _compare(comp)
72  {
73  }
74 
75  template <typename InputIterator>
76  multiset_vector(InputIterator first, InputIterator last, const Compare& comp = Compare(),
77  const Allocator& alloc = Allocator())
78  : _content(first, last, alloc)
79  , _compare(comp)
80  {
81  sort();
82  }
83 
84  #ifdef USE_CXX11
85  multiset_vector(const multiset_vector&) = default;
86  multiset_vector(multiset_vector&&) = default;
87  #else
89  : _content(copy._content)
90  , _compare(copy._compare)
91  {
92  }
93  #endif
94 
95  explicit multiset_vector(const Allocator& alloc)
96  : _content(alloc)
97  , _compare()
98  {
99  }
100 
101  multiset_vector(const multiset_vector& copy, const Allocator& alloc)
102  : _content(copy._content, alloc)
103  , _compare(copy._compare)
104  {
105  }
106 
107  #ifdef USE_CXX11
108  multiset_vector(multiset_vector&& copy, const Allocator& alloc)
109  : _content(std::move(copy), alloc)
110  , _compare(std::move(copy._compare))
111  {
112  }
113 
114  multiset_vector(std::initializer_list<value_type> values, const Compare& comp = Compare(),
115  const Allocator& alloc = Allocator())
116  : multiset_vector(values.begin(), values.end(), comp, alloc)
117  {
118  }
119  #endif
120 
122  }
123 
124  #ifdef USE_CXX11
125  multiset_vector& operator=(const multiset_vector&) = default;
127  multiset_vector& operator=(std::initializer_list<value_type> content)
128  {
129  _content.assign(content.begin(), content.end());
130  sort();
131  return *this;
132  }
133  #else
135  {
136  _content = copy._content;
137  _compare = copy._compare;
138  return *this;
139  }
140  #endif
141 
143  return _content.get_allocator();
144  }
145 
147 
148 
151  return _content.begin();
152  }
154  return _content.end();
155  }
156 
158  return _content.begin();
159  }
161  return _content.end();
162  }
163 
165  return _content.rbegin();
166  }
168  return _content.rend();
169  }
170 
172  return _content.rbegin();
173  }
175  return _content.rend();
176  }
177 
179  return _content.begin();
180  }
182  return _content.end();
183  }
184 
186  return _content.rbegin();
187  }
189  return _content.rend();
190  }
191 
193 
195 
198  return _content[i];
199  }
200 
202  return _content.at(i);
203  }
204 
206  return _content.data();
207  }
208 
210  return _content.front();
211  }
212 
214  return _content.back();
215  }
216 
218  const content_t& vector() const {
219  return _content;
220  }
221 
223 
225 
227  bool empty() const NOEXCEPT {
228  return _content.empty();
229  }
231  return _content.size();
232  }
234  return _content.max_size();
235  }
236 
237  #ifdef USE_CXX11
238  void shrink_to_fit() {
239  _content.shrink_to_fit();
240  }
241  #endif
242 
244  _content.reserve(n);
245  }
246 
248 
249 
251  #ifdef USE_CXX11
252  template <typename ... Args> iterator emplace(Args&& ... args)
253  {
254  auto value = value_type(std::forward<Args>(args) ...);
255  return this->_insert(std::move(value));
256  }
257  template <typename ... Args> iterator emplace_hint(const_iterator hint, Args&& ... args)
258  {
259  auto value = value_type(std::forward<Args>(args) ...);
260  return this->_insert_hint(hint, std::move(value));
261  }
262 
263  iterator insert(value_type&& value) {
264  return this->_insert(std::move(value));
265  }
266 
267  iterator insert(const_iterator pos, value_type&& value) {
268  return this->_insert_hint(pos, value);
269  }
270 
271  void insert(std::initializer_list<value_type> values)
272  {
273  for(const value_type& v : values)
274  this->_insert(v);
275  }
276 
277  #endif
278 
279  iterator insert(const value_type& value) {
280  return this->_insert(value);
281  }
282 
284  return this->_insert_hint(pos, value);
285  }
286 
287  template <typename InputIterator> void insert(InputIterator first, InputIterator last)
288  {
289  if(this->empty()) {
290  _content.assign(first, last);
291  this->sort();
292  } else {
293  for(InputIterator it = first; it != last; ++it)
294  this->_insert(*it);
295  }
296  }
297 
299  return _content.erase(this->remove_iterator_const(position));
300  }
301 
303  {
304  const_iterator low = this->lower_bound(x);
305  const_iterator up = this->upper_bound(x);
306  if(low != up) {
307  size_type n = std::distance(low, up);
308  this->erase(low, up);
309  return n;
310  }
311  return 0u;
312  }
313 
315  {
316  return _content.erase(remove_iterator_const(first), remove_iterator_const(last));
317  }
318 
319  void swap(multiset_vector& other)
320  {
321  using std::swap;
322  swap(_content, other._content);
323  }
324 
325  void clear() NOEXCEPT {
326  _content.clear();
327  }
328 
330 
331 
334  return _compare;
335  }
337  return _compare;
338  }
339 
341 
343 
346  {
347  return this->remove_iterator_const(const_cast<const multiset_vector*>(this)->find(k));
348  }
349 
350  const_iterator find(const key_type& k) const
351  {
352  const_iterator pos = std::lower_bound(this->begin(), this->end(), k, this->key_comp());
353  if(pos != this->end() and this->equiv_keys(*pos, k))
354  return pos;
355  return this->end();
356  }
357 
358  size_type count(const key_type& k) const
359  {
360  const_iterator low = this->lower_bound(k);
361  const_iterator up = this->upper_bound(k);
362  return std::distance(low, up);
363  }
364 
366  {
367  return this->remove_iterator_const(const_cast<const multiset_vector*>(this)->lower_bound(k));
368  }
369 
371  {
372  return std::lower_bound(this->begin(), this->end(), k, this->key_comp());
373  }
374 
375  iterator upper_bound(const key_type& k)
376  {
377  return this->remove_iterator_const(const_cast<const multiset_vector*>(this)->upper_bound(k));
378  }
379 
381  {
382  return std::upper_bound(this->begin(), this->end(), k, this->key_comp());
383  }
384 
385  std::pair<iterator, iterator> equal_range(const key_type& k)
386  {
387  typedef std::pair<const_iterator, const_iterator> const_result_t;
388  const_result_t res = const_cast<const multiset_vector*>(this)->equal_range(k);
389  typedef std::pair<iterator, iterator> result_t;
390  return result_t(this->remove_iterator_const(res.first), this->remove_iterator_const(res.second));
391  }
392 
393  std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const
394  {
395  typedef std::pair<const_iterator, const_iterator> result_t;
396  return result_t(this->lower_bound(k), this->upper_bound(k));
397  }
398 
399  friend bool operator==(const multiset_vector& v1, const multiset_vector& v2)
400  {
401  if(v1.size() != v2.size())
402  return false;
403  for(const_iterator it1 = v1.begin(), it2 = v2.begin(); it1 != v1.end(); ++it1, ++it2)
404  if(v1.differ_keys(*it1, *it2))
405  return false;
406  return true;
407  }
408 
409  friend bool operator!=(const multiset_vector& v1, const multiset_vector& v2) {
410  return not (v1 == v2);
411  }
412 
413  friend bool operator<(const multiset_vector& v1, const multiset_vector& v2)
414  {
415  const_iterator it1 = v1.begin(), it2 = v2.begin();
416  const_iterator last_v1 = v1.end(), last_v2 = v2.end();
417  for(; it1 != last_v1 and it2 != last_v2; ++it1, ++it2) {
418  if(v1.compare(*it1, *it2))
419  return true;
420  else if(v1.compare(*it2, *it1))
421  return false;
422  }
423  if(it2 != last_v2)
424  return true;
425  return false;
426  }
427 
428  friend bool operator>(const multiset_vector& v1, const multiset_vector& v2)
429  {
430  const_iterator it1 = v1.begin(), it2 = v2.begin();
431  const_iterator last_v1 = v1.end(), last_v2 = v2.end();
432  for(; it1 != last_v1 and it2 != last_v2; ++it1, ++it2) {
433  if(v1.compare(*it1, *it2))
434  return false;
435  else if(v1.compare(*it2, *it1))
436  return true;
437  }
438  if(it1 != last_v1)
439  return true;
440  return false;
441  }
442 
443  friend bool operator<=(const multiset_vector& v1, const multiset_vector& v2) {
444  return not (v1 > v2);
445  }
446 
447  friend bool operator>=(const multiset_vector& v1, const multiset_vector& v2) {
448  return not (v1 < v2);
449  }
450 
451  protected:
452  typename content_t::iterator remove_iterator_const(const_iterator it) {
453  return _content.begin() + (it - begin());
454  }
455 
456  void sort()
457  {
458  if(_content.size() == 0)
459  return;
460  std::sort(_content.begin(), _content.end(), this->key_comp());
461  }
462 
464  {
465  return std::upper_bound(first, last, value, this->key_comp());
466  }
467 
468  const_iterator _find_insert_hint(const_iterator hint, const value_type& value)
469  {
470  if(hint == this->end()) {
471  if(size() > 0) {
472  if(this->compare(this->back(), value))
473  return this->end();
474  else
475  return this->_find_insert_range(this->begin(), this->end(), value);
476  }
477  return this->end();
478  }
479  if(this->compare(value, *hint)) { // Try just before
480  if(hint == this->begin())
481  return hint;
482  const_iterator before = hint;
483  if(this->compare(*(--before), value))
484  return hint;
485  return this->_find_insert_range(this->begin(), before, value);
486  } else if(this->compare(*hint, value)) { // Try just after
487  const_iterator after = hint;
488  if(++after == this->end() or this->compare(value, *after))
489  return after;
490  return this->_find_insert_range(after, this->end(), value);
491  } else
492  return hint;
493  }
494 
495  template <typename T>
496  #ifdef USE_CXX11
497  iterator _insert_vector(const_iterator it, T&& value)
498  #else
500  #endif
501  {
502  return _content.insert(this->remove_iterator_const(it), STD_FORWARD(T, value));
503  }
504 
505  template <typename T>
506  #ifdef USE_CXX11
507  iterator _insert(T&& value)
508  #else
509  iterator _insert(const T& value)
510  #endif
511  {
512  iterator found = this->_find_insert_range(this->begin(), this->end(), value);
513  return this->_insert_vector(found, STD_FORWARD(T, value));
514  }
515 
516  template <typename T>
517  #ifdef USE_CXX11
518  iterator _insert_hint(const_iterator hint, T&& value)
519  #else
520  iterator _insert_hint(const_iterator hint, const T& value)
521  #endif
522  {
523  iterator found = this->_find_insert_hint(hint, value);
524  return this->_insert_vector(found, STD_FORWARD(T, value));
525  }
526 
527  bool equiv_keys(const key_type& k1, const key_type& k2) const
528  {
529  return not (this->compare(k1, k2) or this->compare(k2, k1));
530  }
531 
532  bool differ_keys(const key_type& k1, const key_type& k2) const
533  {
534  return this->compare(k1, k2) or this->compare(k2, k1);
535  }
536 
537  bool compare(const key_type& k1, const key_type& k2) const {
538  return _compare(k1, k2);
539  }
540  };
541 
542  template <typename Key, typename Compare, typename Allocator>
544  {
545  v1.swap(v2);
546  }
547 
553  template <typename Key, typename Compare = std::less<Key>, class Allocator = std::allocator<Key> >
554  class set_vector : public multiset_vector<Key, Compare, Allocator> {
556 
557  public:
558  typedef typename super_type::key_type key_type;
565 
566  typedef typename super_type::pointer pointer;
568 
569  typedef typename super_type::iterator iterator;
573 
576 
578  explicit set_vector(const Compare& comp = Compare(), const Allocator& alloc = Allocator())
580  : super_type(comp, alloc)
581  {
582  }
583 
584  template <typename InputIterator>
585  set_vector(InputIterator first, InputIterator last, const Compare& comp = Compare(),
586  const Allocator& alloc = Allocator())
587  : super_type(first, last, comp, alloc)
588  {
589  this->clean();
590  }
591 
592  #ifdef USE_CXX11
593  set_vector(const set_vector&) = default;
594  set_vector(set_vector&&) = default;
595  #else
596  set_vector(const set_vector& copy)
597  : super_type(copy)
598  {
599  }
600  #endif
601 
602  explicit set_vector(const Allocator& alloc)
603  : super_type(alloc)
604  {
605  }
606 
607  set_vector(const set_vector& copy, const Allocator& alloc)
608  : super_type(copy, alloc)
609  {
610  }
611 
612  #ifdef USE_CXX11
613  set_vector(set_vector&& copy, const Allocator& alloc)
614  : super_type(std::move(copy), alloc)
615  {
616  }
617 
618  set_vector(std::initializer_list<value_type> values, const Compare& comp = Compare(),
619  const Allocator& alloc = Allocator())
620  : set_vector(values.begin(), values.end(), comp, alloc)
621  {
622  }
623  #endif
624 
626  }
627 
628  #ifdef USE_CXX11
629  set_vector& operator=(const set_vector&) = default;
630  set_vector& operator=(set_vector&&) = default;
631  set_vector& operator=(std::initializer_list<value_type> content)
632  {
633  super_type::operator=(content);
634  this->clean();
635  return *this;
636  }
637  #else
639  {
640  super_type::operator=(copy);
641  return *this;
642  }
643  #endif
644 
646 
648 
650  #ifdef USE_CXX11
651  template <typename ... Args> std::pair<iterator, bool> emplace(Args&& ... args)
652  {
653  auto value = value_type(std::forward<Args>(args) ...);
654  return this->_insert(std::move(value));
655  }
656  template <typename ... Args> std::pair<iterator, bool> emplace_hint(const_iterator hint, Args&& ... args)
657  {
658  auto value = value_type(std::forward<Args>(args) ...);
659  return this->_insert_hint(hint, std::move(value));
660  }
661 
662  std::pair<iterator, bool> insert(value_type&& value) {
663  return this->_insert(std::move(value));
664  }
665 
666  std::pair<iterator, bool> insert(const_iterator pos, value_type&& value) {
667  return this->_insert_hint(pos, value);
668  }
669 
670  void insert(std::initializer_list<value_type> values)
671  {
672  for(const value_type& v : values)
673  this->_insert(v);
674  }
675 
676  #endif
677 
678  std::pair<iterator, bool> insert(const value_type& value) {
679  return this->_insert(value);
680  }
681 
682  std::pair<iterator, bool> insert(const_iterator pos, const value_type& value)
683  {
684  return this->_insert_hint(pos, value);
685  }
686 
687  template <typename InputIterator> void insert(InputIterator first, InputIterator last)
688  {
689  for(InputIterator it = first; it != last; ++it)
690  this->_insert(*it);
691  }
692 
693  using super_type::erase;
694 
696  {
697  const_iterator it = std::lower_bound(this->begin(), this->end(), x, this->key_comp());
698  if(it != this->end() and this->equiv_keys(*it, x)) {
699  this->erase(it);
700  return 1u;
701  }
702  return 0u;
703  }
704 
705  void swap(set_vector& other) {
706  super_type::swap(other);
707  }
708 
710 
711  private:
712  void clean()
713  {
714  size_type s = this->size();
715  if(s == 0)
716  return;
717  for(size_t i = s - 1; i > 0; --i) {
718  if(this->equiv_keys((*this)[i], (*this)[i - 1]))
719  this->erase(this->begin() + i);
720  }
721  }
722 
723  std::pair<iterator, bool> _find_insert_range(const_iterator first, const_iterator last,
724  const value_type& value) const
725  {
726  typedef std::pair<const_iterator, bool> result_t;
727  const_iterator pos = std::lower_bound(first, last, value, this->key_comp());
728  return result_t(pos, (pos == last or this->differ_keys(*pos, value)));
729  }
730 
731  std::pair<const_iterator, bool> _find_insert_hint(const_iterator hint, const value_type& value)
732  {
733  typedef std::pair<iterator, bool> result_t;
734  if(hint == this->end()) {
735  if(this->size() > 0) {
736  if(this->compare(this->back(), value))
737  return result_t(this->end(), true);
738  else
739  return _find_insert_range(this->begin(), this->end(), value);
740  }
741  return result_t(this->end(), value);
742  }
743  if(this->compare(value, *hint)) { // Try just before
744  if(hint == this->begin())
745  return result_t(hint, true);
746  const_iterator before = hint;
747  if(this->compare(*(--before), value))
748  return result_t(hint, true);
749  return this->_find_insert_range(this->begin(), before, value);
750  } else if(this->compare(*hint, value)) { // Try just after
751  const_iterator after = hint;
752  if(++after == this->end() or this->compare(value, *after))
753  return result_t(after, true);
754  return this->_find_insert_range(after, this->end(), value);
755  } else
756  return result_t(hint, false);
757  }
758 
759  #ifdef USE_CXX11
760  template <typename T> std::pair<iterator, bool> _insert(T&& value)
761  #else
762  std::pair<iterator, bool> _insert(const value_type& value)
763  #endif
764  {
765  std::pair<iterator, bool> found = this->_find_insert_range(this->begin(), this->end(), value);
766  if(found.second)
767  found.first = this->_insert_vector(found.first, STD_FORWARD(T, value));
768  return found;
769  }
770 
771  #ifdef USE_CXX11
772  template <typename T> std::pair<iterator, bool> _insert_hint(const_iterator hint, T&& value)
773  #else
774  std::pair<iterator, bool> _insert_hint(const_iterator hint, const value_type& value)
775  #endif
776  {
777  std::pair<iterator, bool> found = this->_find_insert_hint(hint, value);
778  if(found.second)
779  found.first = this->_insert_vector(found.first, STD_FORWARD(T, value));
780  return found;
781  }
782  };
783 
784  template <typename Key, typename Compare, typename Allocator>
786  {
787  v1.swap(v2);
788  }
789 
790  #undef STD_FORWARD
791  #undef NOEXCEPT
792 }
793 #endif
mgx::set_vector::allocator_type
super_type::allocator_type allocator_type
Definition: SetVector.hpp:562
mgx::multiset_vector::begin
iterator begin() NOEXCEPT
Definition: SetVector.hpp:150
mgx::set_vector::key_compare
super_type::key_compare key_compare
Definition: SetVector.hpp:560
mgx::multiset_vector::multiset_vector
multiset_vector(const multiset_vector &copy, const Allocator &alloc)
Definition: SetVector.hpp:101
mgx::multiset_vector::lower_bound
iterator lower_bound(const key_type &k)
Definition: SetVector.hpp:365
mgx::set_vector::set_vector
set_vector(const Allocator &alloc)
Definition: SetVector.hpp:602
mgx::multiset_vector::pointer
allocator_type::pointer pointer
Definition: SetVector.hpp:55
mgx::multiset_vector::clear
void clear() NOEXCEPT
Definition: SetVector.hpp:325
mgx::multiset_vector::multiset_vector
multiset_vector(const Allocator &alloc)
Definition: SetVector.hpp:95
mgx::set_vector::set_vector
set_vector(InputIterator first, InputIterator last, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
Definition: SetVector.hpp:585
mgx::multiset_vector::operator=
multiset_vector & operator=(const multiset_vector &copy)
Definition: SetVector.hpp:134
mgx::multiset_vector::~multiset_vector
~multiset_vector()
Definition: SetVector.hpp:121
mgx::multiset_vector::operator<=
friend bool operator<=(const multiset_vector &v1, const multiset_vector &v2)
Definition: SetVector.hpp:443
mgx::multiset_vector::difference_type
content_t::difference_type difference_type
Definition: SetVector.hpp:62
mgx::multiset_vector::differ_keys
bool differ_keys(const key_type &k1, const key_type &k2) const
Definition: SetVector.hpp:532
mgx::multiset_vector::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: SetVector.hpp:64
mgx::multiset_vector::insert
void insert(InputIterator first, InputIterator last)
Definition: SetVector.hpp:287
n
#define n
Definition: Eigenvalues.hpp:36
mgx::set_vector::iterator
super_type::iterator iterator
Definition: SetVector.hpp:569
STD_FORWARD
#define STD_FORWARD(T, V)
Definition: SetVector.hpp:26
mgx::set_vector::insert
std::pair< iterator, bool > insert(const value_type &value)
Definition: SetVector.hpp:678
mgx::multiset_vector::const_iterator
content_t::const_iterator const_iterator
Definition: SetVector.hpp:60
mgx::set_vector::const_reference
super_type::const_reference const_reference
Definition: SetVector.hpp:564
mgx::multiset_vector::_insert
iterator _insert(const T &value)
Definition: SetVector.hpp:509
mgx::set_vector::value_compare
super_type::value_compare value_compare
Definition: SetVector.hpp:561
mgx::multiset_vector::swap
void swap(multiset_vector &other)
Definition: SetVector.hpp:319
mgx::multiset_vector::vector
const content_t & vector() const
Return the underlying vector.
Definition: SetVector.hpp:218
mgx::multiset_vector::operator>
friend bool operator>(const multiset_vector &v1, const multiset_vector &v2)
Definition: SetVector.hpp:428
mgx::set_vector::reference
super_type::reference reference
Definition: SetVector.hpp:563
mgx::multiset_vector::rend
reverse_iterator rend() NOEXCEPT
Definition: SetVector.hpp:167
mgx::set_vector::reverse_iterator
super_type::reverse_iterator reverse_iterator
Definition: SetVector.hpp:574
mgx::ForAll::pointer
T * pointer(const T &)
Definition: VVGraph.hpp:89
mgx::multiset_vector::key_type
Key key_type
Definition: SetVector.hpp:43
mgx::multiset_vector::insert
iterator insert(const value_type &value)
Definition: SetVector.hpp:279
mgx::set_vector::set_vector
set_vector(const set_vector &copy, const Allocator &alloc)
Definition: SetVector.hpp:607
mgx::multiset_vector::value_comp
value_compare value_comp() const
Definition: SetVector.hpp:336
mgx::set_vector::set_vector
set_vector(const set_vector &copy)
Definition: SetVector.hpp:596
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::multiset_vector::iterator
content_t::const_iterator iterator
Definition: SetVector.hpp:59
mgx::set_vector::difference_type
super_type::difference_type difference_type
Definition: SetVector.hpp:572
mgx::multiset_vector::operator==
friend bool operator==(const multiset_vector &v1, const multiset_vector &v2)
Definition: SetVector.hpp:399
mgx::multiset_vector::value_type
Key value_type
Definition: SetVector.hpp:44
mgx::multiset_vector
Definition: SetVector.hpp:37
mgx::swap
void swap(multiset_vector< Key, Compare, Allocator > &v1, multiset_vector< Key, Compare, Allocator > &v2)
Definition: SetVector.hpp:543
mgx::multiset_vector::rend
const_reverse_iterator rend() const NOEXCEPT
Definition: SetVector.hpp:174
mgx::multiset_vector::get_allocator
allocator_type get_allocator() const NOEXCEPT
Definition: SetVector.hpp:142
mgx::multiset_vector::erase
size_type erase(const key_type &x)
Definition: SetVector.hpp:302
mgx::multiset_vector::reserve
void reserve(size_type n)
Definition: SetVector.hpp:243
mgx::multiset_vector::equiv_keys
bool equiv_keys(const key_type &k1, const key_type &k2) const
Definition: SetVector.hpp:527
mgx::set_vector::size_type
super_type::size_type size_type
Definition: SetVector.hpp:571
mgx::multiset_vector::const_reference
const typedef value_type & const_reference
Definition: SetVector.hpp:49
mgx::set_vector::operator=
set_vector & operator=(const set_vector &copy)
Definition: SetVector.hpp:638
mgx::multiset_vector::find
iterator find(const key_type &k)
Definition: SetVector.hpp:345
mgx::multiset_vector::equal_range
std::pair< const_iterator, const_iterator > equal_range(const key_type &k) const
Definition: SetVector.hpp:393
mgx::multiset_vector::key_comp
key_compare key_comp() const
Definition: SetVector.hpp:333
mgx::multiset_vector::crbegin
const_reverse_iterator crbegin() const NOEXCEPT
Definition: SetVector.hpp:185
mgx::multiset_vector::begin
const_iterator begin() const NOEXCEPT
Definition: SetVector.hpp:157
mgx::multiset_vector::multiset_vector
multiset_vector(const Compare &comp=Compare(), const Allocator &alloc=Allocator())
Definition: SetVector.hpp:69
mgx::multiset_vector::count
size_type count(const key_type &k) const
Definition: SetVector.hpp:358
mgx::multiset_vector::back
const_reference back() const
Definition: SetVector.hpp:213
mgx::set_vector::const_reverse_iterator
super_type::const_reverse_iterator const_reverse_iterator
Definition: SetVector.hpp:575
mgx::set_vector::insert
void insert(InputIterator first, InputIterator last)
Definition: SetVector.hpp:687
mgx::multiset_vector::empty
bool empty() const NOEXCEPT
Definition: SetVector.hpp:227
mgx::multiset_vector::value_compare
Compare value_compare
Definition: SetVector.hpp:46
mgx::multiset_vector::erase
iterator erase(const_iterator position)
Definition: SetVector.hpp:298
mgx::multiset_vector::end
iterator end() NOEXCEPT
Definition: SetVector.hpp:153
mgx::multiset_vector::upper_bound
const_iterator upper_bound(const key_type &k) const
Definition: SetVector.hpp:380
mgx::set_vector::const_pointer
super_type::const_pointer const_pointer
Definition: SetVector.hpp:567
mgx::multiset_vector::lower_bound
const_iterator lower_bound(const key_type &k) const
Definition: SetVector.hpp:370
mgx::multiset_vector::_find_insert_hint
const_iterator _find_insert_hint(const_iterator hint, const value_type &value)
Definition: SetVector.hpp:468
mgx::multiset_vector::front
const_reference front() const
Definition: SetVector.hpp:209
mgx::multiset_vector::multiset_vector
multiset_vector(InputIterator first, InputIterator last, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
Definition: SetVector.hpp:76
mgx::multiset_vector::remove_iterator_const
content_t::iterator remove_iterator_const(const_iterator it)
Definition: SetVector.hpp:452
mgx::multiset_vector::size_type
content_t::size_type size_type
Definition: SetVector.hpp:61
mgx::multiset_vector::operator>=
friend bool operator>=(const multiset_vector &v1, const multiset_vector &v2)
Definition: SetVector.hpp:447
mgx::set_vector
Definition: SetVector.hpp:554
mgx::multiset_vector::rbegin
reverse_iterator rbegin() NOEXCEPT
Definition: SetVector.hpp:164
mgx::multiset_vector::key_compare
Compare key_compare
Definition: SetVector.hpp:45
mgx::multiset_vector::_insert_hint
iterator _insert_hint(const_iterator hint, const T &value)
Definition: SetVector.hpp:520
mgx::multiset_vector::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: SetVector.hpp:65
mgx::multiset_vector::operator[]
const_reference operator[](size_type i) const
Definition: SetVector.hpp:197
mgx::set_vector::swap
void swap(set_vector &other)
Definition: SetVector.hpp:705
mgx::set_vector::key_type
super_type::key_type key_type
Definition: SetVector.hpp:558
mgx::set_vector::erase
size_type erase(const key_type &x)
Definition: SetVector.hpp:695
mgx::multiset_vector::rbegin
const_reverse_iterator rbegin() const NOEXCEPT
Definition: SetVector.hpp:171
mgx::multiset_vector::_find_insert_range
iterator _find_insert_range(const_iterator first, const_iterator last, const value_type &value) const
Definition: SetVector.hpp:463
mgx::set_vector::const_iterator
super_type::const_iterator const_iterator
Definition: SetVector.hpp:570
NOEXCEPT
#define NOEXCEPT
Definition: SetVector.hpp:25
mgx::multiset_vector::at
const_reference at(size_type i) const
Definition: SetVector.hpp:201
mgx::set_vector::value_type
super_type::value_type value_type
Definition: SetVector.hpp:559
mgx::multiset_vector::upper_bound
iterator upper_bound(const key_type &k)
Definition: SetVector.hpp:375
mgx::multiset_vector::max_size
size_type max_size() const NOEXCEPT
Definition: SetVector.hpp:233
mgx::multiset_vector::multiset_vector
multiset_vector(const multiset_vector &copy)
Definition: SetVector.hpp:88
mgx::set_vector::pointer
super_type::pointer pointer
Definition: SetVector.hpp:566
mgx::multiset_vector::end
const_iterator end() const NOEXCEPT
Definition: SetVector.hpp:160
mgx::multiset_vector::const_pointer
allocator_type::const_pointer const_pointer
Definition: SetVector.hpp:56
mgx::multiset_vector::find
const_iterator find(const key_type &k) const
Definition: SetVector.hpp:350
mgx::multiset_vector::data
const_pointer data() const NOEXCEPT
Definition: SetVector.hpp:205
mgx::multiset_vector::equal_range
std::pair< iterator, iterator > equal_range(const key_type &k)
Definition: SetVector.hpp:385
mgx::multiset_vector::allocator_type
Allocator allocator_type
Definition: SetVector.hpp:47
mgx::multiset_vector::cend
const_iterator cend() const NOEXCEPT
Definition: SetVector.hpp:181
mgx::swap
void swap(set_vector< Key, Compare, Allocator > &v1, set_vector< Key, Compare, Allocator > &v2)
Definition: SetVector.hpp:785
mgx::multiset_vector::_insert_vector
iterator _insert_vector(const_iterator it, const T &value)
Definition: SetVector.hpp:499
mgx::multiset_vector::erase
iterator erase(const_iterator first, const_iterator last)
Definition: SetVector.hpp:314
mgx::multiset_vector::insert
iterator insert(const_iterator pos, const value_type &value)
Definition: SetVector.hpp:283
mgx::set_vector::~set_vector
~set_vector()
Definition: SetVector.hpp:625
mgx::multiset_vector::size
size_type size() const NOEXCEPT
Definition: SetVector.hpp:230
mgx::multiset_vector::cbegin
const_iterator cbegin() const NOEXCEPT
Definition: SetVector.hpp:178
mgx::set_vector::set_vector
set_vector(const Compare &comp=Compare(), const Allocator &alloc=Allocator())
Definition: SetVector.hpp:579
mgx::set_vector::insert
std::pair< iterator, bool > insert(const_iterator pos, const value_type &value)
Definition: SetVector.hpp:682
mgx::multiset_vector::operator!=
friend bool operator!=(const multiset_vector &v1, const multiset_vector &v2)
Definition: SetVector.hpp:409
mgx::multiset_vector::crend
const_reverse_iterator crend() const NOEXCEPT
Definition: SetVector.hpp:188
mgx::multiset_vector::compare
bool compare(const key_type &k1, const key_type &k2) const
Definition: SetVector.hpp:537
mgx::multiset_vector::reference
value_type & reference
Definition: SetVector.hpp:48
mgx::multiset_vector::operator<
friend bool operator<(const multiset_vector &v1, const multiset_vector &v2)
Definition: SetVector.hpp:413
mgx::multiset_vector::sort
void sort()
Definition: SetVector.hpp:456