SDSL 3.0.3
Succinct Data Structure Library
Loading...
Searching...
No Matches
sdsl::int_vector< t_width > Class Template Reference

A generic vector class for integers of width $w\in [1..64]$. More...

#include <int_vector.hpp>

Inheritance diagram for sdsl::int_vector< t_width >:
sdsl::_bwt_sampling< t_csa, t_bit_vec, t_rank_sup, t_width > sdsl::_isa_sampling< csa_bitcompressed, 0 > sdsl::_isa_sampling< t_csa, t_width > sdsl::_sa_order_sampling< csa_bitcompressed, 0 > sdsl::_sa_order_sampling< t_csa, t_width > sdsl::_text_order_sampling< t_csa, t_bit_vec, t_rank_sup, t_width >

Classes

struct  raw_wrapper

Public Types

typedef int_vector_trait< t_width >::value_type value_type
typedef int_vector_trait< t_width >::iterator iterator
typedef int_vector_trait< t_width >::const_iterator const_iterator
typedef int_vector_trait< t_width >::reference reference
typedef int_vector_trait< t_width >::const_reference const_reference
typedef int_vector_reference< int_vector > * pointer
typedef value_type const * const_pointer
typedef ptrdiff_t difference_type
typedef int_vector_size_type size_type
typedef int_vector_trait< t_width >::int_width_type int_width_type
typedef rank_support_v< 1, 1 > rank_1_type
typedef rank_support_v< 0, 1 > rank_0_type
typedef select_support_mcl< 1, 1 > select_1_type
typedef select_support_mcl< 0, 1 > select_0_type
typedef int_vec_category_trait< t_width >::type index_category

Public Member Functions

 int_vector (size_type size, value_type default_value, uint8_t int_width=t_width)
 Constructor for int_vector.
 int_vector (size_type size=0)
 Constructor to fix possible comparison with integeres issue.
 int_vector (std::initializer_list< value_type > il)
 Constructor for initializer_list.
template<typename input_iterator_t>
 int_vector (typename std::enable_if< std::is_base_of< std::input_iterator_tag, typename std::iterator_traits< input_iterator_t >::iterator_category >::value, input_iterator_t >::type first, input_iterator_t last)
 Constructor for iterator range.
void clear () noexcept
 Clearing the int_vector. Allocated memory will not be released.
iterator erase (const_iterator it)
 Remove element that iterator is pointing to.
iterator erase (const_iterator first, const_iterator last)
 Remove elements in given iterator range.
template<class... Args>
iterator emplace (const_iterator it, Args &&... args)
 Insert an element constructed with std::forward<Args>(args) before the element that the iterator is pointing to.
iterator insert (const_iterator it, value_type value)
 Insert an element before the element that the iterator is pointing to.
iterator insert (const_iterator it, size_type n, value_type value)
 Insert n copies of an element before the element that the iterator is pointing to.
iterator insert (const_iterator it, std::initializer_list< value_type > il)
 Insert elements from intializer_list before the element that the iterator is pointing to.
template<typename input_iterator_t>
std::enable_if< std::is_base_of< std::input_iterator_tag, typenamestd::iterator_traits< input_iterator_t >::iterator_category >::value, iterator >::type insert (const_iterator it, input_iterator_t first, input_iterator_t last)
 Insert elements from an iterator pair before the element that the iterator it is pointing to.
reference front () noexcept
 Returns first element.
const_reference front () const noexcept
 Returns first element.
reference back () noexcept
 Returns last element.
const_reference back () const noexcept
 Returns last element.
template<class... Args>
void emplace_back (Args &&... args)
 Insert an element constructed with std::forward<Args>(args) at the end.
void push_back (value_type value)
 Insert element at the end.
void pop_back ()
 Remove element at the end.
 int_vector (int_vector &&v)
 Move constructor.
 int_vector (int_vector const &v)
 Copy constructor.
 ~int_vector ()
 Destructor.
void assign (size_type size, value_type default_value)
 Assign. Resize int_vector to size and fill elements with default_value.
void assign (std::initializer_list< value_type > il)
 Assign. Resize int_vector and initialize with initializer_list.
template<typename input_iterator_t>
void assign (input_iterator_t first, input_iterator_t last)
 Assign. Resize int_vector and initialize by copying from an iterator range.
bool empty () const noexcept
 Equivalent to size() == 0.
void swap (int_vector &v) noexcept
 Swap method for int_vector.
void shrink_to_fit ()
 Free unused allocated memory.
void reserve (size_type capacity)
 Reserve storage. If the new capacity is smaller than the current, this method does nothing.
void resize (const size_type size)
 Resize the int_vector in terms of elements.
void resize (const size_type size, const value_type value)
 Resize the int_vector in terms of elements. Only as much space as necessary is allocated.
void bit_resize (const size_type size)
 Resize the int_vector in terms of bits. Only as much space as necessary is allocated.
size_type size () const noexcept
 The number of elements in the int_vector.
size_type bit_size () const noexcept
 The number of bits in the int_vector.
size_type capacity () const noexcept
 Returns the size of the occupied bits of the int_vector.
size_type bit_capacity () const noexcept
 Returns the size of the occupied bits of the int_vector.
uint64_t const * data () const noexcept
 Pointer to the raw data of the int_vector.
uint64_t * data () noexcept
 Pointer to the raw data of the int_vector.
value_type get_int (size_type idx, const uint8_t len=64) const
 Get the integer value of the binary string of length len starting at position idx in the int_vector.
void set_int (size_type idx, value_type x, const uint8_t len=64)
 Set the bits from position idx to idx+len-1 to the binary representation of integer x.
uint8_t width () const noexcept
 Returns the width of the integers which are accessed via the [] operator.
void width (uint8_t new_width) noexcept
 Sets the width of the integers which are accessed via the [] operator, if t_width equals 0.
size_type write_data (std::ostream &out) const
size_type serialize (std::ostream &out, structure_tree_node *v=nullptr, std::string name="") const
 Serializes the int_vector to a stream.
void load (std::istream &in)
 Load the int_vector for a stream.
template<typename archive_t>
std::enable_if<!cereal::traits::is_output_serializable< cereal::BinaryData< int_vector< t_width > >, archive_t >::value, void >::type CEREAL_SAVE_FUNCTION_NAME (archive_t &ar) const
 Serialise (save) via cereal if archive is not binary.
template<typename archive_t>
std::enable_if< cereal::traits::is_output_serializable< cereal::BinaryData< int_vector< t_width > >, archive_t >::value, void >::type CEREAL_SAVE_FUNCTION_NAME (archive_t &ar) const
 Serialise (save) via cereal if archive is binary.
template<typename archive_t>
std::enable_if<!cereal::traits::is_input_serializable< cereal::BinaryData< int_vector< t_width > >, archive_t >::value, void >::type CEREAL_LOAD_FUNCTION_NAME (archive_t &ar)
 Serialise (load) via cereal if archive is not binary.
template<typename archive_t>
std::enable_if< cereal::traits::is_input_serializable< cereal::BinaryData< int_vector< t_width > >, archive_t >::value, void >::type CEREAL_LOAD_FUNCTION_NAME (archive_t &ar)
 Serialise (save) via cereal if archive is binary.
reference operator[] (size_type const &i) noexcept
 non const version of [] operator
const_reference operator[] (size_type const &i) const noexcept
 const version of [] operator
reference at (size_type const &i)
 non const version of at() function
const_reference at (size_type const &i) const
 const version of at() function
int_vectoroperator= (int_vector const &v)
 Assignment operator.
int_vectoroperator= (int_vector &&v)
 Move assignment operator.
bool operator== (int_vector< t_width > const &v) const noexcept
 Equality operator for two int_vectors.
template<uint8_t t_width2>
bool operator== (int_vector< t_width2 > const &v) const noexcept
 Equality operator for two int_vectors.
template<uint8_t t_width2>
bool operator!= (int_vector< t_width2 > const &v) const noexcept
 Inequality operator for two int_vectors.
bool operator< (int_vector const &v) const noexcept
 Less operator for two int_vectors.
bool operator> (int_vector const &v) const noexcept
 Greater operator for two int_vectors.
bool operator<= (int_vector const &v) const noexcept
 Less or equal operator.
bool operator>= (int_vector const &v) const noexcept
 Greater of equal operator.
int_vectoroperator&= (int_vector const &v)
 bitwise-and-update operator
int_vectoroperator|= (int_vector const &v)
 bitwise-or-update equal operator
int_vectoroperator^= (int_vector const &v)
 bitwise-xor-update operator
iterator begin () noexcept
 Iterator that points to the first element of the int_vector.
iterator end () noexcept
 Iterator that points to the element after the last element of int_vector.
const_iterator begin () const noexcept
 Const iterator that points to the first element of the int_vector.
const_iterator end () const noexcept
 Const iterator that points to the element after the last element of int_vector.
const_iterator cbegin () const noexcept
 Const iterator that points to the first element of the int_vector.
const_iterator cend () const noexcept
 Const iterator that points to the element after the last element of int_vector.
void flip ()
 Flip all bits of bit_vector.
int_vector< 64 >::size_type size () const noexcept
int_vector< 32 >::size_type size () const noexcept
int_vector< 16 >::size_type size () const noexcept
int_vector< 8 >::size_type size () const noexcept
int_vector< 1 >::size_type size () const noexcept
int_vector< 0 >::size_type size () const noexcept
int_vector< 64 >::size_type capacity () const noexcept
int_vector< 32 >::size_type capacity () const noexcept
int_vector< 16 >::size_type capacity () const noexcept
int_vector< 8 >::size_type capacity () const noexcept
int_vector< 1 >::size_type capacity () const noexcept
int_vector< 0 >::size_type capacity () const noexcept
auto operator[] (size_type const &idx) noexcept -> reference
auto operator[] (size_type const &idx) noexcept -> reference
auto operator[] (size_type const &idx) noexcept -> reference
auto operator[] (size_type const &idx) noexcept -> reference
auto operator[] (size_type const &idx) const noexcept -> const_reference
auto operator[] (size_type const &idx) const noexcept -> const_reference
auto operator[] (size_type const &idx) const noexcept -> const_reference
auto operator[] (size_type const &idx) const noexcept -> const_reference
auto operator[] (size_type const &idx) const noexcept -> const_reference
auto operator[] (size_type const &idx) const noexcept -> const_reference

Static Public Member Functions

static size_type max_size () noexcept
 Maximum size of the int_vector.
static size_t read_header (int_vector_size_type &size, int_width_type &int_width, std::istream &in)
 Read the size and int_width of a int_vector.
static uint64_t write_header (uint64_t size, uint8_t int_width, std::ostream &out)
 Write the size and int_width of a int_vector.

Public Attributes

float growth_factor = 1.5
 Growth factor for amortized constant time operations.
const raw_wrapper raw = raw_wrapper(*this)

Static Public Attributes

static constexpr uint8_t fixed_int_width = t_width

Friends

struct int_vector_trait< t_width >
class int_vector_iterator_base< int_vector >
class int_vector_iterator< int_vector >
class int_vector_const_iterator< int_vector >
template<uint8_t, std::ios_base::openmode>
class int_vector_mapper
template<typename T>
class coder::elias_delta
template<typename T>
class coder::elias_gamma
template<typename T>
class coder::fibonacci
template<uint8_t>
class coder::comma
class memory_manager

Detailed Description

template<uint8_t t_width>
class sdsl::int_vector< t_width >

A generic vector class for integers of width $w\in [1..64]$.

Author
Simon Gog

This generic vector class could be used to generate a vector that contains integers of fixed width $w\in [1..64]$. It has a growth factor of 1.5 to achieve amortized running time. Note that resize() does not reserve more space than necessary.

Template Parameters
t_widthWidth of the integer. If set to 0 it is variable during runtime, otherwise fixed at compile time.

Definition at line 211 of file int_vector.hpp.

Member Typedef Documentation

◆ const_iterator

template<uint8_t t_width>
typedef int_vector_trait<t_width>::const_iterator sdsl::int_vector< t_width >::const_iterator

Definition at line 219 of file int_vector.hpp.

◆ const_pointer

template<uint8_t t_width>
typedef value_type const* sdsl::int_vector< t_width >::const_pointer

Definition at line 223 of file int_vector.hpp.

◆ const_reference

template<uint8_t t_width>
typedef int_vector_trait<t_width>::const_reference sdsl::int_vector< t_width >::const_reference

Definition at line 221 of file int_vector.hpp.

◆ difference_type

template<uint8_t t_width>
typedef ptrdiff_t sdsl::int_vector< t_width >::difference_type

Definition at line 224 of file int_vector.hpp.

◆ index_category

template<uint8_t t_width>
typedef int_vec_category_trait<t_width>::type sdsl::int_vector< t_width >::index_category

Definition at line 231 of file int_vector.hpp.

◆ int_width_type

template<uint8_t t_width>
typedef int_vector_trait<t_width>::int_width_type sdsl::int_vector< t_width >::int_width_type

Definition at line 226 of file int_vector.hpp.

◆ iterator

template<uint8_t t_width>
typedef int_vector_trait<t_width>::iterator sdsl::int_vector< t_width >::iterator

Definition at line 218 of file int_vector.hpp.

◆ pointer

template<uint8_t t_width>
typedef int_vector_reference<int_vector>* sdsl::int_vector< t_width >::pointer

Definition at line 222 of file int_vector.hpp.

◆ rank_0_type

template<uint8_t t_width>
typedef rank_support_v<0, 1> sdsl::int_vector< t_width >::rank_0_type

Definition at line 228 of file int_vector.hpp.

◆ rank_1_type

template<uint8_t t_width>
typedef rank_support_v<1, 1> sdsl::int_vector< t_width >::rank_1_type

Definition at line 227 of file int_vector.hpp.

◆ reference

template<uint8_t t_width>
typedef int_vector_trait<t_width>::reference sdsl::int_vector< t_width >::reference

Definition at line 220 of file int_vector.hpp.

◆ select_0_type

template<uint8_t t_width>
typedef select_support_mcl<0, 1> sdsl::int_vector< t_width >::select_0_type

Definition at line 230 of file int_vector.hpp.

◆ select_1_type

template<uint8_t t_width>
typedef select_support_mcl<1, 1> sdsl::int_vector< t_width >::select_1_type

Definition at line 229 of file int_vector.hpp.

◆ size_type

template<uint8_t t_width>
typedef int_vector_size_type sdsl::int_vector< t_width >::size_type

Definition at line 225 of file int_vector.hpp.

◆ value_type

template<uint8_t t_width>
typedef int_vector_trait<t_width>::value_type sdsl::int_vector< t_width >::value_type

Definition at line 217 of file int_vector.hpp.

Constructor & Destructor Documentation

◆ int_vector() [1/6]

template<uint8_t t_width>
sdsl::int_vector< t_width >::int_vector ( size_type size,
value_type default_value,
uint8_t int_width = t_width )
inline

Constructor for int_vector.

Parameters
sizeNumber of elements. Default value is 0.
default_valueInitialize all value to default value.
int_widthThe width of each integer.
See also
resize, width

Definition at line 1588 of file int_vector.hpp.

◆ int_vector() [2/6]

template<uint8_t t_width>
sdsl::int_vector< t_width >::int_vector ( size_type size = 0)
inlineexplicit

Constructor to fix possible comparison with integeres issue.

Definition at line 312 of file int_vector.hpp.

◆ int_vector() [3/6]

template<uint8_t t_width>
sdsl::int_vector< t_width >::int_vector ( std::initializer_list< value_type > il)
inline

Constructor for initializer_list.

Definition at line 315 of file int_vector.hpp.

◆ int_vector() [4/6]

template<uint8_t t_width>
template<typename input_iterator_t>
sdsl::int_vector< t_width >::int_vector ( typename std::enable_if< std::is_base_of< std::input_iterator_tag, typename std::iterator_traits< input_iterator_t >::iterator_category >::value, input_iterator_t >::type first,
input_iterator_t last )
inline

Constructor for iterator range.

Parameters
firstIterator pointing to first element to be copied.
lastIterator pointing to the element behind the last one to be copied.

Definition at line 325 of file int_vector.hpp.

◆ int_vector() [5/6]

template<uint8_t t_width>
sdsl::int_vector< t_width >::int_vector ( int_vector< t_width > && v)
inline

Move constructor.

Definition at line 1599 of file int_vector.hpp.

◆ int_vector() [6/6]

template<uint8_t t_width>
sdsl::int_vector< t_width >::int_vector ( int_vector< t_width > const & v)
inline

Copy constructor.

Definition at line 1611 of file int_vector.hpp.

◆ ~int_vector()

template<uint8_t t_width>
sdsl::int_vector< t_width >::~int_vector ( )

Destructor.

Definition at line 1658 of file int_vector.hpp.

Member Function Documentation

◆ assign() [1/3]

template<uint8_t t_width>
template<typename input_iterator_t>
void sdsl::int_vector< t_width >::assign ( input_iterator_t first,
input_iterator_t last )
inline

Assign. Resize int_vector and initialize by copying from an iterator range.

Parameters
firstIterator pointing to first element to be inserted.
lastIterator pointing to the elemnt after the one to be inserted.

Definition at line 514 of file int_vector.hpp.

◆ assign() [2/3]

template<uint8_t t_width>
void sdsl::int_vector< t_width >::assign ( size_type size,
value_type default_value )
inline

Assign. Resize int_vector to size and fill elements with default_value.

Parameters
sizeNumber of elements.
default_valueElements to be inserted.

Definition at line 490 of file int_vector.hpp.

◆ assign() [3/3]

template<uint8_t t_width>
void sdsl::int_vector< t_width >::assign ( std::initializer_list< value_type > il)
inline

Assign. Resize int_vector and initialize with initializer_list.

Parameters
ilInitializer_list.

Definition at line 499 of file int_vector.hpp.

◆ at() [1/2]

template<uint8_t t_width>
reference sdsl::int_vector< t_width >::at ( size_type const & i)
inline

non const version of at() function

Parameters
iIndex the i-th integer of length width().
Returns
A reference to the i-th integer of length width().

Definition at line 730 of file int_vector.hpp.

◆ at() [2/2]

template<uint8_t t_width>
const_reference sdsl::int_vector< t_width >::at ( size_type const & i) const
inline

const version of at() function

Parameters
iIndex the i-th integer of length width().
Returns
The value of the i-th integer of length width().

Definition at line 739 of file int_vector.hpp.

◆ back() [1/2]

template<uint8_t t_width>
const_reference sdsl::int_vector< t_width >::back ( ) const
inlinenoexcept

Returns last element.

Definition at line 448 of file int_vector.hpp.

◆ back() [2/2]

template<uint8_t t_width>
reference sdsl::int_vector< t_width >::back ( )
inlinenoexcept

Returns last element.

Definition at line 442 of file int_vector.hpp.

◆ begin() [1/2]

template<uint8_t t_width>
const_iterator sdsl::int_vector< t_width >::begin ( ) const
inlinenoexcept

Const iterator that points to the first element of the int_vector.

Definition at line 847 of file int_vector.hpp.

◆ begin() [2/2]

template<uint8_t t_width>
iterator sdsl::int_vector< t_width >::begin ( )
inlinenoexcept

Iterator that points to the first element of the int_vector.

Time complexity guaranty is O(1).

Definition at line 833 of file int_vector.hpp.

◆ bit_capacity()

template<uint8_t t_width>
size_type sdsl::int_vector< t_width >::bit_capacity ( ) const
inlinenoexcept

Returns the size of the occupied bits of the int_vector.

The bit_capacity of a int_vector is greater or equal to the bit_size of the vector: bit_capacity() >= bit_size().

See also
size, bit_size, max_size, capacity, bit_capacity

Definition at line 611 of file int_vector.hpp.

◆ bit_resize()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::bit_resize ( const size_type size)

Resize the int_vector in terms of bits. Only as much space as necessary is allocated.

Parameters
sizeThe size to resize the int_vector in terms of bits.

Definition at line 1671 of file int_vector.hpp.

◆ bit_size()

template<uint8_t t_width>
size_type sdsl::int_vector< t_width >::bit_size ( ) const
inlinenoexcept

The number of bits in the int_vector.

See also
size, max_size, bit_size, capacity

Definition at line 594 of file int_vector.hpp.

◆ capacity() [1/7]

template<uint8_t t_width>
int_vector< t_width >::size_type sdsl::int_vector< t_width >::capacity ( ) const
inlinenoexcept

Returns the size of the occupied bits of the int_vector.

The capacity of a int_vector is greater or equal to the size of the vector: capacity() >= size().

See also
size, bit_size, max_size, capacity, bit_capacity

Definition at line 1770 of file int_vector.hpp.

◆ capacity() [2/7]

int_vector< 64 >::size_type sdsl::int_vector< 64 >::capacity ( ) const
inlinenoexcept

Definition at line 1777 of file int_vector.hpp.

◆ capacity() [3/7]

int_vector< 32 >::size_type sdsl::int_vector< 32 >::capacity ( ) const
inlinenoexcept

Definition at line 1784 of file int_vector.hpp.

◆ capacity() [4/7]

int_vector< 16 >::size_type sdsl::int_vector< 16 >::capacity ( ) const
inlinenoexcept

Definition at line 1791 of file int_vector.hpp.

◆ capacity() [5/7]

int_vector< 8 >::size_type sdsl::int_vector< 8 >::capacity ( ) const
inlinenoexcept

Definition at line 1798 of file int_vector.hpp.

◆ capacity() [6/7]

int_vector< 1 >::size_type sdsl::int_vector< 1 >::capacity ( ) const
inlinenoexcept

Definition at line 1805 of file int_vector.hpp.

◆ capacity() [7/7]

int_vector< 0 >::size_type sdsl::int_vector< 0 >::capacity ( ) const
inlinenoexcept

Definition at line 1812 of file int_vector.hpp.

◆ cbegin()

template<uint8_t t_width>
const_iterator sdsl::int_vector< t_width >::cbegin ( ) const
inlinenoexcept

Const iterator that points to the first element of the int_vector.

Definition at line 859 of file int_vector.hpp.

◆ cend()

template<uint8_t t_width>
const_iterator sdsl::int_vector< t_width >::cend ( ) const
inlinenoexcept

Const iterator that points to the element after the last element of int_vector.

Definition at line 865 of file int_vector.hpp.

◆ CEREAL_LOAD_FUNCTION_NAME() [1/2]

template<uint8_t t_width>
template<typename archive_t>
std::enable_if<!cereal::traits::is_input_serializable< cereal::BinaryData< int_vector< t_width > >, archive_t >::value, void >::type sdsl::int_vector< t_width >::CEREAL_LOAD_FUNCTION_NAME ( archive_t & ar)
inline

Serialise (load) via cereal if archive is not binary.

Definition at line 2056 of file int_vector.hpp.

◆ CEREAL_LOAD_FUNCTION_NAME() [2/2]

template<uint8_t t_width>
template<typename archive_t>
std::enable_if< cereal::traits::is_input_serializable< cereal::BinaryData< int_vector< t_width > >, archive_t >::value, void >::type sdsl::int_vector< t_width >::CEREAL_LOAD_FUNCTION_NAME ( archive_t & ar)
inline

Serialise (save) via cereal if archive is binary.

◆ CEREAL_SAVE_FUNCTION_NAME() [1/2]

template<uint8_t t_width>
template<typename archive_t>
std::enable_if<!cereal::traits::is_output_serializable< cereal::BinaryData< int_vector< t_width > >, archive_t >::value, void >::type sdsl::int_vector< t_width >::CEREAL_SAVE_FUNCTION_NAME ( archive_t & ar) const
inline

Serialise (save) via cereal if archive is not binary.

Definition at line 2029 of file int_vector.hpp.

◆ CEREAL_SAVE_FUNCTION_NAME() [2/2]

template<uint8_t t_width>
template<typename archive_t>
std::enable_if< cereal::traits::is_output_serializable< cereal::BinaryData< int_vector< t_width > >, archive_t >::value, void >::type sdsl::int_vector< t_width >::CEREAL_SAVE_FUNCTION_NAME ( archive_t & ar) const
inline

Serialise (save) via cereal if archive is binary.

◆ clear()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::clear ( )
inlinenoexcept

Clearing the int_vector. Allocated memory will not be released.

See also
resize

Definition at line 338 of file int_vector.hpp.

◆ data() [1/2]

template<uint8_t t_width>
uint64_t const * sdsl::int_vector< t_width >::data ( ) const
inlinenoexcept

Pointer to the raw data of the int_vector.

Returns
Const pointer to the raw data of the int_vector

Definition at line 619 of file int_vector.hpp.

◆ data() [2/2]

template<uint8_t t_width>
uint64_t * sdsl::int_vector< t_width >::data ( )
inlinenoexcept

Pointer to the raw data of the int_vector.

Returns
pointer to the raw data of the int_vector

Definition at line 627 of file int_vector.hpp.

◆ emplace()

template<uint8_t t_width>
template<class... Args>
iterator sdsl::int_vector< t_width >::emplace ( const_iterator it,
Args &&... args )
inline

Insert an element constructed with std::forward<Args>(args) before the element that the iterator is pointing to.

Parameters
itIterator pointing to an element in int_vector.
argsFunction parameter pack.

Definition at line 372 of file int_vector.hpp.

◆ emplace_back()

template<uint8_t t_width>
template<class... Args>
void sdsl::int_vector< t_width >::emplace_back ( Args &&... args)
inline

Insert an element constructed with std::forward<Args>(args) at the end.

Parameters
argsFunction parameter pack.

Definition at line 457 of file int_vector.hpp.

◆ empty()

template<uint8_t t_width>
bool sdsl::int_vector< t_width >::empty ( ) const
inlinenoexcept

Equivalent to size() == 0.

Definition at line 526 of file int_vector.hpp.

◆ end() [1/2]

template<uint8_t t_width>
const_iterator sdsl::int_vector< t_width >::end ( ) const
inlinenoexcept

Const iterator that points to the element after the last element of int_vector.

Definition at line 853 of file int_vector.hpp.

◆ end() [2/2]

template<uint8_t t_width>
iterator sdsl::int_vector< t_width >::end ( )
inlinenoexcept

Iterator that points to the element after the last element of int_vector.

Time complexity guaranty is O(1).

Definition at line 841 of file int_vector.hpp.

◆ erase() [1/2]

template<uint8_t t_width>
iterator sdsl::int_vector< t_width >::erase ( const_iterator first,
const_iterator last )
inline

Remove elements in given iterator range.

Parameters
firstIterator pointing to first element to be deleted.
lastIterator pointing to the elemnt after the one to be deleted.

Definition at line 358 of file int_vector.hpp.

◆ erase() [2/2]

template<uint8_t t_width>
iterator sdsl::int_vector< t_width >::erase ( const_iterator it)
inline

Remove element that iterator is pointing to.

Parameters
itIterator pointing to an element in int_vector

Definition at line 346 of file int_vector.hpp.

◆ flip()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::flip ( )
inline

Flip all bits of bit_vector.

Definition at line 871 of file int_vector.hpp.

◆ front() [1/2]

template<uint8_t t_width>
const_reference sdsl::int_vector< t_width >::front ( ) const
inlinenoexcept

Returns first element.

Definition at line 436 of file int_vector.hpp.

◆ front() [2/2]

template<uint8_t t_width>
reference sdsl::int_vector< t_width >::front ( )
inlinenoexcept

Returns first element.

Definition at line 430 of file int_vector.hpp.

◆ get_int()

template<uint8_t t_width>
auto sdsl::int_vector< t_width >::get_int ( size_type idx,
const uint8_t len = 64 ) const

Get the integer value of the binary string of length len starting at position idx in the int_vector.

Parameters
idxStarting index of the binary representation of the integer.
lenLength of the binary representation of the integer. Default value is 64.
Returns
The integer value of the binary string of length len starting at position idx.
See also
setInt, getBit, setBit

Definition at line 1690 of file int_vector.hpp.

◆ insert() [1/4]

template<uint8_t t_width>
template<typename input_iterator_t>
std::enable_if< std::is_base_of< std::input_iterator_tag, typenamestd::iterator_traits< input_iterator_t >::iterator_category >::value, iterator >::type sdsl::int_vector< t_width >::insert ( const_iterator it,
input_iterator_t first,
input_iterator_t last )
inline

Insert elements from an iterator pair before the element that the iterator it is pointing to.

Parameters
itIterator pointing to an element in int_vector.
firstIterator pointing to first element to be inserted.
lastIterator pointing to the elemnt after the one to be inserted.

Definition at line 419 of file int_vector.hpp.

◆ insert() [2/4]

template<uint8_t t_width>
iterator sdsl::int_vector< t_width >::insert ( const_iterator it,
size_type n,
value_type value )
inline

Insert n copies of an element before the element that the iterator is pointing to.

Parameters
itIterator pointing to an element in int_vector.
nNumber of copies.
valueElement to be inserted.

Definition at line 391 of file int_vector.hpp.

◆ insert() [3/4]

template<uint8_t t_width>
iterator sdsl::int_vector< t_width >::insert ( const_iterator it,
std::initializer_list< value_type > il )
inline

Insert elements from intializer_list before the element that the iterator is pointing to.

Parameters
itIterator pointing to an element in int_vector.
ilElements to be inserted.

Definition at line 405 of file int_vector.hpp.

◆ insert() [4/4]

template<uint8_t t_width>
iterator sdsl::int_vector< t_width >::insert ( const_iterator it,
value_type value )
inline

Insert an element before the element that the iterator is pointing to.

Parameters
itIterator pointing to an element in int_vector.
valueElement to be inserted.

Definition at line 381 of file int_vector.hpp.

◆ load()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::load ( std::istream & in)

Load the int_vector for a stream.

Definition at line 2007 of file int_vector.hpp.

◆ max_size()

template<uint8_t t_width>
size_type sdsl::int_vector< t_width >::max_size ( )
inlinestaticnoexcept

Maximum size of the int_vector.

See also
size, bit_size, capacity, bit_capacity

Definition at line 586 of file int_vector.hpp.

◆ operator!=()

template<uint8_t t_width>
template<uint8_t t_width2>
bool sdsl::int_vector< t_width >::operator!= ( int_vector< t_width2 > const & v) const
inlinenoexcept

Inequality operator for two int_vectors.

Two int_vectors are not equal if

  • sizes are not equal or
  • its elements are not equal. Note that comparing two int_vectors of different widths is slow since it compares element by element and not the bit representations of the int_vectors.

Definition at line 795 of file int_vector.hpp.

◆ operator&=()

template<uint8_t t_width>
int_vector< t_width > & sdsl::int_vector< t_width >::operator&= ( int_vector< t_width > const & v)

bitwise-and-update operator

Definition at line 1951 of file int_vector.hpp.

◆ operator<()

template<uint8_t t_width>
bool sdsl::int_vector< t_width >::operator< ( int_vector< t_width > const & v) const
noexcept

Less operator for two int_vectors.

int_vector w is less than v if

  • w[i]==v[i] for i<j and w[j]<v[j] with j in [0, min(w.size(), v.size()) )
  • or w[i]==v[i] for all i < min(w.size(), v.size()) and w.size()<v.size().
    See also
    operator>

Definition at line 1907 of file int_vector.hpp.

◆ operator<=()

template<uint8_t t_width>
bool sdsl::int_vector< t_width >::operator<= ( int_vector< t_width > const & v) const
noexcept

Less or equal operator.

Definition at line 1939 of file int_vector.hpp.

◆ operator=() [1/2]

template<uint8_t t_width>
int_vector< t_width > & sdsl::int_vector< t_width >::operator= ( int_vector< t_width > && v)

Move assignment operator.

Definition at line 1640 of file int_vector.hpp.

◆ operator=() [2/2]

template<uint8_t t_width>
int_vector< t_width > & sdsl::int_vector< t_width >::operator= ( int_vector< t_width > const & v)

Assignment operator.

Parameters
vThe vector v which should be assigned

Definition at line 1629 of file int_vector.hpp.

◆ operator==() [1/2]

template<uint8_t t_width>
bool sdsl::int_vector< t_width >::operator== ( int_vector< t_width > const & v) const
inlinenoexcept

Equality operator for two int_vectors.

Two int_vectors are equal if

  • sizes are equal and
  • its elements are equal.

Definition at line 757 of file int_vector.hpp.

◆ operator==() [2/2]

template<uint8_t t_width>
template<uint8_t t_width2>
bool sdsl::int_vector< t_width >::operator== ( int_vector< t_width2 > const & v) const
inlinenoexcept

Equality operator for two int_vectors.

Note that this function is slow since it compares element by element and cannot compare the bit representations of the containers. Two containers are equal if

  • sizes are equal and
  • its elements are equal.

Definition at line 782 of file int_vector.hpp.

◆ operator>()

template<uint8_t t_width>
bool sdsl::int_vector< t_width >::operator> ( int_vector< t_width > const & v) const
noexcept

Greater operator for two int_vectors.

int_vector w is greater than v if

  • w[i]==v[i] for i<j and w[j]>v[j] with j in [0, min(w.size(), v.size()) )
  • or w[i]==v[i] for all i < min(w.size(), v.size()) and w.size()>v.size().

Definition at line 1923 of file int_vector.hpp.

◆ operator>=()

template<uint8_t t_width>
bool sdsl::int_vector< t_width >::operator>= ( int_vector< t_width > const & v) const
noexcept

Greater of equal operator.

Definition at line 1945 of file int_vector.hpp.

◆ operator[]() [1/12]

template<uint8_t t_width>
auto sdsl::int_vector< t_width >::operator[] ( size_type const & i) const
inlinenoexcept

const version of [] operator

Parameters
iIndex the i-th integer of length width().
Returns
The value of the i-th integer of length width().

Definition at line 1858 of file int_vector.hpp.

◆ operator[]() [2/12]

template<uint8_t t_width>
auto sdsl::int_vector< t_width >::operator[] ( size_type const & i)
inlinenoexcept

non const version of [] operator

Parameters
iIndex the i-th integer of length width().
Returns
A reference to the i-th integer of length width().

Definition at line 1818 of file int_vector.hpp.

◆ operator[]() [3/12]

auto sdsl::int_vector< 0 >::operator[] ( size_type const & idx) const -> const_reference
inlinenoexcept

Definition at line 1865 of file int_vector.hpp.

◆ operator[]() [4/12]

auto sdsl::int_vector< 64 >::operator[] ( size_type const & idx) const -> const_reference
inlinenoexcept

Definition at line 1872 of file int_vector.hpp.

◆ operator[]() [5/12]

auto sdsl::int_vector< 32 >::operator[] ( size_type const & idx) const -> const_reference
inlinenoexcept

Definition at line 1879 of file int_vector.hpp.

◆ operator[]() [6/12]

auto sdsl::int_vector< 16 >::operator[] ( size_type const & idx) const -> const_reference
inlinenoexcept

Definition at line 1886 of file int_vector.hpp.

◆ operator[]() [7/12]

auto sdsl::int_vector< 8 >::operator[] ( size_type const & idx) const -> const_reference
inlinenoexcept

Definition at line 1893 of file int_vector.hpp.

◆ operator[]() [8/12]

auto sdsl::int_vector< 1 >::operator[] ( size_type const & idx) const -> const_reference
inlinenoexcept

Definition at line 1900 of file int_vector.hpp.

◆ operator[]() [9/12]

auto sdsl::int_vector< 64 >::operator[] ( size_type const & idx) -> reference
inlinenoexcept

Definition at line 1827 of file int_vector.hpp.

◆ operator[]() [10/12]

auto sdsl::int_vector< 32 >::operator[] ( size_type const & idx) -> reference
inlinenoexcept

Definition at line 1835 of file int_vector.hpp.

◆ operator[]() [11/12]

auto sdsl::int_vector< 16 >::operator[] ( size_type const & idx) -> reference
inlinenoexcept

Definition at line 1843 of file int_vector.hpp.

◆ operator[]() [12/12]

auto sdsl::int_vector< 8 >::operator[] ( size_type const & idx) -> reference
inlinenoexcept

Definition at line 1851 of file int_vector.hpp.

◆ operator^=()

template<uint8_t t_width>
int_vector< t_width > & sdsl::int_vector< t_width >::operator^= ( int_vector< t_width > const & v)

bitwise-xor-update operator

Definition at line 1969 of file int_vector.hpp.

◆ operator|=()

template<uint8_t t_width>
int_vector< t_width > & sdsl::int_vector< t_width >::operator|= ( int_vector< t_width > const & v)

bitwise-or-update equal operator

Definition at line 1960 of file int_vector.hpp.

◆ pop_back()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::pop_back ( )
inline

Remove element at the end.

Definition at line 472 of file int_vector.hpp.

◆ push_back()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::push_back ( value_type value)
inline

Insert element at the end.

Parameters
valueElement to be inserted.

Definition at line 465 of file int_vector.hpp.

◆ read_header()

template<uint8_t t_width>
size_t sdsl::int_vector< t_width >::read_header ( int_vector_size_type & size,
int_width_type & int_width,
std::istream & in )
inlinestatic

Read the size and int_width of a int_vector.

Definition at line 884 of file int_vector.hpp.

◆ reserve()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::reserve ( size_type capacity)
inline

Reserve storage. If the new capacity is smaller than the current, this method does nothing.

Parameters
capacityNew capacity in bits

Definition at line 546 of file int_vector.hpp.

◆ resize() [1/2]

template<uint8_t t_width>
void sdsl::int_vector< t_width >::resize ( const size_type size)
inline

Resize the int_vector in terms of elements.

If the current size is smaller than size, the additional elements are initialized with 0.

Only as much space as necessary is being allocated.

Parameters
sizeNumber of elements.

Definition at line 559 of file int_vector.hpp.

◆ resize() [2/2]

template<uint8_t t_width>
void sdsl::int_vector< t_width >::resize ( const size_type size,
const value_type value )
inline

Resize the int_vector in terms of elements. Only as much space as necessary is allocated.

Parameters
sizeThe size to resize the int_vector in terms of elements.
valueIf the current size is smaller than size, the additional elements are initialized with value.

Definition at line 568 of file int_vector.hpp.

◆ serialize()

template<uint8_t t_width>
int_vector< t_width >::size_type sdsl::int_vector< t_width >::serialize ( std::ostream & out,
structure_tree_node * v = nullptr,
std::string name = "" ) const

Serializes the int_vector to a stream.

Returns
The number of bytes written to out.
See also
load

Definition at line 1997 of file int_vector.hpp.

◆ set_int()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::set_int ( size_type idx,
value_type x,
const uint8_t len = 64 )
inline

Set the bits from position idx to idx+len-1 to the binary representation of integer x.

The bit at position idx represents the least significant bit(lsb), and the bit at position idx+len-1 the most significant bit (msb) of x.

Parameters
idxStarting index of the binary representation of x.
xThe integer to store in the int_vector.
lenThe length used to store x in the int_vector. Default value is 64.
See also
getInt, getBit, setBit

Definition at line 1706 of file int_vector.hpp.

◆ shrink_to_fit()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::shrink_to_fit ( )
inline

Free unused allocated memory.

Definition at line 538 of file int_vector.hpp.

◆ size() [1/7]

template<uint8_t t_width>
int_vector< t_width >::size_type sdsl::int_vector< t_width >::size ( ) const
inlinenoexcept

The number of elements in the int_vector.

See also
max_size, bit_size, capacity, bit_capacity

Definition at line 1722 of file int_vector.hpp.

◆ size() [2/7]

int_vector< 64 >::size_type sdsl::int_vector< 64 >::size ( ) const
inlinenoexcept

Definition at line 1729 of file int_vector.hpp.

◆ size() [3/7]

int_vector< 32 >::size_type sdsl::int_vector< 32 >::size ( ) const
inlinenoexcept

Definition at line 1736 of file int_vector.hpp.

◆ size() [4/7]

int_vector< 16 >::size_type sdsl::int_vector< 16 >::size ( ) const
inlinenoexcept

Definition at line 1743 of file int_vector.hpp.

◆ size() [5/7]

int_vector< 8 >::size_type sdsl::int_vector< 8 >::size ( ) const
inlinenoexcept

Definition at line 1750 of file int_vector.hpp.

◆ size() [6/7]

int_vector< 1 >::size_type sdsl::int_vector< 1 >::size ( ) const
inlinenoexcept

Definition at line 1757 of file int_vector.hpp.

◆ size() [7/7]

int_vector< 0 >::size_type sdsl::int_vector< 0 >::size ( ) const
inlinenoexcept

Definition at line 1764 of file int_vector.hpp.

◆ swap()

template<uint8_t t_width>
void sdsl::int_vector< t_width >::swap ( int_vector< t_width > & v)
inlinenoexcept

Swap method for int_vector.

Definition at line 532 of file int_vector.hpp.

◆ width() [1/2]

template<uint8_t t_width>
uint8_t sdsl::int_vector< t_width >::width ( ) const
inlinenoexcept

Returns the width of the integers which are accessed via the [] operator.

Returns
The width of the integers which are accessed via the [] operator.
See also
width

Definition at line 654 of file int_vector.hpp.

◆ width() [2/2]

template<uint8_t t_width>
void sdsl::int_vector< t_width >::width ( uint8_t new_width)
inlinenoexcept

Sets the width of the integers which are accessed via the [] operator, if t_width equals 0.

Parameters
new_widthNew width of the integers accessed via the [] operator.
Note
This method has no effect if t_width is in the range [1..64].
See also
width

Definition at line 664 of file int_vector.hpp.

◆ write_data()

template<uint8_t t_width>
int_vector< t_width >::size_type sdsl::int_vector< t_width >::write_data ( std::ostream & out) const

Definition at line 1978 of file int_vector.hpp.

◆ write_header()

template<uint8_t t_width>
uint64_t sdsl::int_vector< t_width >::write_header ( uint64_t size,
uint8_t int_width,
std::ostream & out )
inlinestatic

Write the size and int_width of a int_vector.

Definition at line 904 of file int_vector.hpp.

◆ coder::comma

template<uint8_t t_width>
template<uint8_t>
friend class coder::comma
friend

Definition at line 246 of file int_vector.hpp.

◆ coder::elias_delta

template<uint8_t t_width>
template<typename T>
friend class coder::elias_delta
friend

Definition at line 240 of file int_vector.hpp.

◆ coder::elias_gamma

template<uint8_t t_width>
template<typename T>
friend class coder::elias_gamma
friend

Definition at line 242 of file int_vector.hpp.

◆ coder::fibonacci

template<uint8_t t_width>
template<typename T>
friend class coder::fibonacci
friend

Definition at line 244 of file int_vector.hpp.

◆ int_vector_const_iterator< int_vector >

template<uint8_t t_width>
friend class int_vector_const_iterator< int_vector >
friend

Definition at line 231 of file int_vector.hpp.

◆ int_vector_iterator< int_vector >

template<uint8_t t_width>
friend class int_vector_iterator< int_vector >
friend

Definition at line 231 of file int_vector.hpp.

◆ int_vector_iterator_base< int_vector >

template<uint8_t t_width>
friend class int_vector_iterator_base< int_vector >
friend

Definition at line 231 of file int_vector.hpp.

◆ int_vector_mapper

template<uint8_t t_width>
template<uint8_t, std::ios_base::openmode>
friend class int_vector_mapper
friend

Definition at line 238 of file int_vector.hpp.

◆ int_vector_trait< t_width >

template<uint8_t t_width>
friend struct int_vector_trait< t_width >
friend

Definition at line 231 of file int_vector.hpp.

◆ memory_manager

template<uint8_t t_width>
friend class memory_manager
friend

Definition at line 247 of file int_vector.hpp.

Member Data Documentation

◆ fixed_int_width

template<uint8_t t_width>
uint8_t sdsl::int_vector< t_width >::fixed_int_width = t_width
staticconstexpr

Definition at line 248 of file int_vector.hpp.

◆ growth_factor

template<uint8_t t_width>
float sdsl::int_vector< t_width >::growth_factor = 1.5

Growth factor for amortized constant time operations.

Definition at line 249 of file int_vector.hpp.

◆ raw

template<uint8_t t_width>
const raw_wrapper sdsl::int_vector< t_width >::raw = raw_wrapper(*this)

Definition at line 934 of file int_vector.hpp.


The documentation for this class was generated from the following file:
  • /builddir/build/BUILD/sdsl-lite-3.0.3-build/sdsl-lite-3.0.3/include/sdsl/int_vector.hpp