MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / OrderedSetWrapper

Class OrderedSetWrapper

source/core/StarOrderedSet.hpp:12–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11template <template <typename...> class Map, typename Value, typename Allocator, typename... Args>
12class OrderedSetWrapper {
13public:
14 typedef Value value_type;
15
16 typedef LinkedList<value_type, typename std::allocator_traits<Allocator>::template rebind_alloc<value_type>> OrderType;
17 typedef Map<
18 std::reference_wrapper<value_type const>, typename OrderType::const_iterator, Args...,
19 typename std::allocator_traits<Allocator>::template rebind_alloc<pair<std::reference_wrapper<value_type const> const, typename OrderType::const_iterator>>
20 > MapType;
21
22 typedef typename OrderType::const_iterator const_iterator;
23 typedef const_iterator iterator;
24
25 typedef typename OrderType::const_reverse_iterator const_reverse_iterator;
26 typedef const_reverse_iterator reverse_iterator;
27
28 template <typename Collection>
29 static OrderedSetWrapper from(Collection const& c);
30
31 OrderedSetWrapper();
32 OrderedSetWrapper(OrderedSetWrapper const& set);
33
34 template <typename InputIterator>
35 OrderedSetWrapper(InputIterator beg, InputIterator end);
36
37 OrderedSetWrapper(initializer_list<value_type> list);
38
39 OrderedSetWrapper& operator=(OrderedSetWrapper const& set);
40
41 // Guaranteed to be in order.
42 List<value_type> values() const;
43
44 bool contains(value_type const& v) const;
45
46 // add either adds the value to the back, or does not move it from its
47 // current order.
48 pair<iterator, bool> insert(value_type const& v);
49
50 // like insert, but only returns whether the value was added or not.
51 bool add(Value const& v);
52
53 // Always replaces an existing value with a new value if it exists, and
54 // always moves to the back.
55 bool replace(Value const& v);
56
57 // Either adds a value to the end of the order, or moves an existing value to
58 // the back.
59 bool addBack(Value const& v);
60
61 // Either adds a value to the beginning of the order, or moves an existing
62 // value to the beginning.
63 bool addFront(Value const& v);
64
65 template <typename Container>
66 void addAll(Container const& c);
67
68 iterator toFront(iterator i);
69

Callers 1

fromMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected