15 #ifndef PAAL_SPLAY_CYCLE_HPP
16 #define PAAL_SPLAY_CYCLE_HPP
23 namespace data_structures {
45 template <
typename Iter>
47 : m_splay_tree(begin, end), m_size(m_splay_tree.
size()) {}
55 return VIter(m_splay_tree.begin(), m_splay_tree.begin(),
67 std::size_t i = m_splay_tree.get_idx(t);
68 assert(i != std::size_t(-1));
69 return VIter(m_splay_tree.splay(i), m_splay_tree.begin(), m_splay_tree.end());
78 auto e = m_splay_tree.end();
79 return VIter(e, e, e);
88 void flip(
const T &begin,
const T &end) {
92 std::size_t b = m_splay_tree.get_idx(begin);
93 assert(b != std::size_t(-1));
94 std::size_t e = m_splay_tree.get_idx(end);
95 assert(e != std::size_t(-1));
97 m_splay_tree.reverse(b, e);
99 m_splay_tree.reverse(e + 1, b - 1);
100 m_splay_tree.reverse(0, m_size - 1);
106 const std::size_t m_size;
111 #endif // PAAL_SPLAY_CYCLE_HPP
VIter vbegin(const T &t) const
vertices begin (from t)
splay_cycle(Iter begin, Iter end)
constructor from range
For given collection (begin -> end) and start iterator pointing to an element inside collection (begi...
Computes size of TypesVector.
VIter vbegin() const
vertices begin
void flip(const T &begin, const T &end)
flips range from begin to end
Cycle based on splay tree.
VIter vend() const
vertices end