sort_set.h - エンジンの C API リファレンス

sort_set.h
  1. #pragma once
  2. #include "functional.h"
  3. namespace stingray_plugin_foundation {
  4. // Set implementation having the same structure and performance characteristics as
  5. // SortedMap.
  6. template < class K, class COMPARE = less >
  7. class SortSet
  8. {
  9. public:
  10. ALLOCATOR_AWARE;
  11. typedef K key_type;
  12. typedef COMPARE key_compare;
  13. typedef Vector<key_type> storage_type;
  14. typedef typename storage_type::iterator iterator;
  15. typedef typename storage_type::const_iterator const_iterator;
  16. explicit SortSet(Allocator &a);
  17. explicit SortSet(const SortSet<K,COMPARE> &o);
  18. void operator=(const SortSet<K,COMPARE> &o);
  19. void swap(SortSet<K,COMPARE> &o);
  20. // Serializes the sort set to the stream.
  21. template <class STREAM> void serialize(STREAM &stream);
  22. Allocator & allocator() const;
  23. unsigned size() const;
  24. void resize(unsigned size);
  25. bool empty() const;
  26. iterator begin();
  27. const_iterator begin() const;
  28. iterator end();
  29. const_iterator end() const;
  30. template <class KEY_EQ> unsigned find_index(const KEY_EQ &k) const;
  31. template <class KEY_EQ> unsigned lower_bound_index(const KEY_EQ &k) const;
  32. template <class KEY_EQ> unsigned upper_bound_index(const KEY_EQ &k) const;
  33. template <class KEY_EQ> iterator find(const KEY_EQ &k);
  34. template <class KEY_EQ> const_iterator find(const KEY_EQ &k) const;
  35. template <class KEY_EQ> iterator lower_bound(const KEY_EQ &k);
  36. template <class KEY_EQ> const_iterator lower_bound(const KEY_EQ &k) const;
  37. template <class KEY_EQ> iterator upper_bound(const KEY_EQ &k);
  38. template <class KEY_EQ> const_iterator upper_bound(const KEY_EQ &k) const;
  39. template <class KEY_EQ> bool has(const KEY_EQ &k) const;
  40. template <class KEY_EQ> int count(const KEY_EQ &k) const;
  41. void clear();
  42. template <class KEY_EQ> void insert(const KEY_EQ &k);
  43. iterator erase(iterator i);
  44. template <class KEY_EQ> void erase(const KEY_EQ &k);
  45. void sort();
  46. void trim();
  47. bool is_multi_set() const;
  48. private:
  49. key_compare _less;
  50. storage_type _data;
  51. };
  52. } // namespace stingray_plugin_foundation
  53. #include "sort_set.inl"