7#ifndef INCLUDED_SDSL_SORTED_STACK_SUPPORT
8#define INCLUDED_SDSL_SORTED_STACK_SUPPORT
95 void load(std::istream & in);
96 template <
typename archive_t>
98 template <
typename archive_t>
112 assert(
empty() ==
false);
118 assert((
empty() or
top() < x) and x <= m_n);
122 m_stack[bn] ^= (1ULL << block_pos(x));
123 if (bn > 0 and m_stack[bn - 1] == 0)
125 m_stack[bn - 1] = 0x8000000000000000ULL | m_top;
136 uint64_t w = m_stack[bn];
137 assert((w >> 63) == 0);
138 w ^= (1ULL << block_pos(m_top));
151 m_top = (bn - 1) * 63 +
bits::hi(w);
156 m_top = w & 0x7FFFFFFFFFFFFFFFULL;
170 written_bytes += m_stack.serialize(out);
172 return written_bytes;
183template <
typename archive_t>
192template <
typename archive_t>
204 return (m_n == other.m_n) && (m_cnt == other.m_cnt) && (m_top == other.m_top) && (m_stack == other.m_stack);
210 return !(*
this == other);
bits.hpp contains the sdsl::bits class.
cereal.hpp offers cereal support
#define CEREAL_LOAD_FUNCTION_NAME
#define CEREAL_SAVE_FUNCTION_NAME
A generic vector class for integers of width .
int_vector_size_type size_type
A stack which contains strictly increasing numbers in the range from to .
size_type top() const
Returns the topmost index on the stack.
int_vector< 64 >::size_type size_type
bool operator==(sorted_stack_support const &other) const noexcept
Equality operator.
void pop()
Pop the topmost index of the stack.
size_type serialize(std::ostream &out, structure_tree_node *v=nullptr, std::string name="") const
sorted_stack_support & operator=(sorted_stack_support const &)=default
bool empty() const
Returns if the stack is empty.
sorted_stack_support(sorted_stack_support const &)=default
void CEREAL_LOAD_FUNCTION_NAME(archive_t &ar)
sorted_stack_support & operator=(sorted_stack_support &&)=default
sorted_stack_support(sorted_stack_support &&)=default
bool operator!=(sorted_stack_support const &other) const noexcept
Inequality operator.
sorted_stack_support(size_type n)
Constructor.
void load(std::istream &in)
void CEREAL_SAVE_FUNCTION_NAME(archive_t &ar) const
void push(size_type x)
Push the index x of vector vec onto the stack.
size_type size() const
Returns the number of element is the stack.
static structure_tree_node * add_child(structure_tree_node *v, std::string const &name, std::string const &type)
static void add_size(structure_tree_node *v, uint64_t value)
int_vector.hpp contains the sdsl::int_vector class.
io.hpp contains some methods for reading/writing sdsl structures.
Namespace for the succinct data structure library.
size_t write_member(T const &t, std::ostream &out, sdsl::structure_tree_node *v=nullptr, std::string name="")
void read_member(T &t, std::istream &in)
static constexpr uint32_t hi(uint64_t x)
Position of the most significant set bit the 64-bit word x.
structure_tree.hpp contains a helper class which can represent the memory structure of a class.
util.hpp contains some helper methods for int_vector and other stuff like demangle class names.