SDSL 3.0.2
Succinct Data Structure Library
Loading...
Searching...
No Matches
sdsl::sorted_int_stack Class Reference

A stack class which can contain integers in strictly increasing order. More...

#include <sorted_int_stack.hpp>

Public Types

typedef int_vector< 64 >::size_type size_type
 

Public Member Functions

 sorted_int_stack (size_type n)
 
 sorted_int_stack (sorted_int_stack const &)=default
 
 sorted_int_stack (sorted_int_stack &&)=default
 
sorted_int_stackoperator= (sorted_int_stack const &)=default
 
sorted_int_stackoperator= (sorted_int_stack &&)=default
 
bool empty () const
 Returns if the stack is empty.
 
size_type top () const
 Returns the topmost element of the stack.
 
void pop ()
 Pop the topmost element of the stack.
 
void push (size_type x)
 Push value x on the stack.
 
size_type size () const
 Returns the number of element is the stack.
 
size_type serialize (std::ostream &out, structure_tree_node *v=nullptr, std::string name="") const
 
void load (std::istream &in)
 
template<typename archive_t >
void CEREAL_SAVE_FUNCTION_NAME (archive_t &ar) const
 
template<typename archive_t >
void CEREAL_LOAD_FUNCTION_NAME (archive_t &ar)
 
bool operator== (sorted_int_stack const &other) const noexcept
 Equality operator.
 
bool operator!= (sorted_int_stack const &other) const noexcept
 Inequality operator.
 

Detailed Description

A stack class which can contain integers in strictly increasing order.

Space complexity
$n+o(n)$ bits + 64 bits for every stored number > n-1.

Definition at line 34 of file sorted_int_stack.hpp.

Member Typedef Documentation

◆ size_type

Definition at line 37 of file sorted_int_stack.hpp.

Constructor & Destructor Documentation

◆ sorted_int_stack() [1/3]

sdsl::sorted_int_stack::sorted_int_stack ( size_type  n)
inline

Definition at line 101 of file sorted_int_stack.hpp.

◆ sorted_int_stack() [2/3]

sdsl::sorted_int_stack::sorted_int_stack ( sorted_int_stack const &  )
default

◆ sorted_int_stack() [3/3]

sdsl::sorted_int_stack::sorted_int_stack ( sorted_int_stack &&  )
default

Member Function Documentation

◆ CEREAL_LOAD_FUNCTION_NAME()

template<typename archive_t >
void sdsl::sorted_int_stack::CEREAL_LOAD_FUNCTION_NAME ( archive_t &  ar)

Definition at line 214 of file sorted_int_stack.hpp.

◆ CEREAL_SAVE_FUNCTION_NAME()

template<typename archive_t >
void sdsl::sorted_int_stack::CEREAL_SAVE_FUNCTION_NAME ( archive_t &  ar) const

Definition at line 204 of file sorted_int_stack.hpp.

◆ empty()

bool sdsl::sorted_int_stack::empty ( ) const
inline

Returns if the stack is empty.

Definition at line 64 of file sorted_int_stack.hpp.

◆ load()

void sdsl::sorted_int_stack::load ( std::istream &  in)
inline

Definition at line 194 of file sorted_int_stack.hpp.

◆ operator!=()

bool sdsl::sorted_int_stack::operator!= ( sorted_int_stack const &  other) const
inlinenoexcept

Inequality operator.

Definition at line 231 of file sorted_int_stack.hpp.

◆ operator=() [1/2]

sorted_int_stack & sdsl::sorted_int_stack::operator= ( sorted_int_stack &&  )
default

◆ operator=() [2/2]

sorted_int_stack & sdsl::sorted_int_stack::operator= ( sorted_int_stack const &  )
default

◆ operator==()

bool sdsl::sorted_int_stack::operator== ( sorted_int_stack const &  other) const
inlinenoexcept

Equality operator.

Definition at line 224 of file sorted_int_stack.hpp.

◆ pop()

void sdsl::sorted_int_stack::pop ( )
inline

Pop the topmost element of the stack.

Definition at line 138 of file sorted_int_stack.hpp.

◆ push()

void sdsl::sorted_int_stack::push ( size_type  x)
inline

Push value x on the stack.

x Value which should be pushed onto the stack.
Precondition
top() < x

Definition at line 112 of file sorted_int_stack.hpp.

◆ serialize()

sorted_int_stack::size_type sdsl::sorted_int_stack::serialize ( std::ostream &  out,
structure_tree_node v = nullptr,
std::string  name = "" 
) const
inline

Definition at line 181 of file sorted_int_stack.hpp.

◆ size()

size_type sdsl::sorted_int_stack::size ( ) const
inline

Returns the number of element is the stack.

Definition at line 86 of file sorted_int_stack.hpp.

◆ top()

sorted_int_stack::size_type sdsl::sorted_int_stack::top ( ) const
inline

Returns the topmost element of the stack.

Precondition
empty()==false

Definition at line 107 of file sorted_int_stack.hpp.


The documentation for this class was generated from the following file: