SDSL 3.0.1
Succinct Data Structure Library
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::_isa_sampling< csa_bitcompressed, 0 > sdsl::_sa_order_sampling< csa_bitcompressed, 0 >

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 const value_typeconst_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. More...
 
 int_vector (size_type size=0)
 Constructor to fix possible comparison with integeres issue. More...
 
 int_vector (std::initializer_list< value_type > il)
 Constructor for initializer_list. More...
 
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. More...
 
void clear () noexcept
 Clearing the int_vector. Allocated memory will not be released. More...
 
iterator erase (const_iterator it)
 Remove element that iterator is pointing to. More...
 
iterator erase (const_iterator first, const_iterator last)
 Remove elements in given iterator range. More...
 
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. More...
 
iterator insert (const_iterator it, value_type value)
 Insert an element before the element that the iterator is pointing to. More...
 
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. More...
 
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. More...
 
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. More...
 
reference front () noexcept
 Returns first element. More...
 
const_reference front () const noexcept
 Returns first element. More...
 
reference back () noexcept
 Returns last element. More...
 
const_reference back () const noexcept
 Returns last element. More...
 
template<class... Args>
void emplace_back (Args &&... args)
 Insert an element constructed with std::forward<Args>(args) at the end. More...
 
void push_back (value_type value)
 Insert element at the end. More...
 
void pop_back ()
 Remove element at the end. More...
 
 int_vector (int_vector &&v)
 Move constructor. More...
 
 int_vector (const int_vector &v)
 Copy constructor. More...
 
 ~int_vector ()
 Destructor. More...
 
void assign (size_type size, value_type default_value)
 Assign. Resize int_vector to size and fill elements with default_value. More...
 
void assign (std::initializer_list< value_type > il)
 Assign. Resize int_vector and initialize with initializer_list. More...
 
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. More...
 
bool empty () const noexcept
 Equivalent to size() == 0. More...
 
void swap (int_vector &v) noexcept
 Swap method for int_vector. More...
 
void shrink_to_fit ()
 Free unused allocated memory. More...
 
void reserve (size_type capacity)
 Reserve storage. If the new capacity is smaller than the current, this method does nothing. More...
 
void resize (const size_type size)
 Resize the int_vector in terms of elements. More...
 
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. More...
 
void bit_resize (const size_type size)
 Resize the int_vector in terms of bits. Only as much space as necessary is allocated. More...
 
size_type size () const noexcept
 The number of elements in the int_vector. More...
 
size_type bit_size () const noexcept
 The number of bits in the int_vector. More...
 
size_type capacity () const noexcept
 Returns the size of the occupied bits of the int_vector. More...
 
size_type bit_capacity () const noexcept
 Returns the size of the occupied bits of the int_vector. More...
 
const uint64_t * data () const noexcept
 Pointer to the raw data of the int_vector. More...
 
uint64_t * data () noexcept
 Pointer to the raw data of the int_vector. More...
 
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. More...
 
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. More...
 
uint8_t width () const noexcept
 Returns the width of the integers which are accessed via the [] operator. More...
 
void width (uint8_t new_width) noexcept
 Sets the width of the integers which are accessed via the [] operator, if t_width equals 0. More...
 
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. More...
 
void load (std::istream &in)
 Load the int_vector for a stream. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
reference operator[] (const size_type &i) noexcept
 non const version of [] operator More...
 
const_reference operator[] (const size_type &i) const noexcept
 const version of [] operator More...
 
reference at (const size_type &i)
 non const version of at() function More...
 
const_reference at (const size_type &i) const
 const version of at() function More...
 
int_vectoroperator= (const int_vector &v)
 Assignment operator. More...
 
int_vectoroperator= (int_vector &&v)
 Move assignment operator. More...
 
bool operator== (const int_vector< t_width > &v) const noexcept
 Equality operator for two int_vectors. More...
 
template<uint8_t t_width2>
bool operator!= (const int_vector< t_width2 > &v) const noexcept
 Inequality operator for two int_vectors. More...
 
bool operator< (const int_vector &v) const noexcept
 Less operator for two int_vectors. More...
 
bool operator> (const int_vector &v) const noexcept
 Greater operator for two int_vectors. More...
 
bool operator<= (const int_vector &v) const noexcept
 Less or equal operator. More...
 
bool operator>= (const int_vector &v) const noexcept
 Greater of equal operator. More...
 
int_vectoroperator&= (const int_vector &v)
 bitwise-and-update operator More...
 
int_vectoroperator|= (const int_vector &v)
 bitwise-or-update equal operator More...
 
int_vectoroperator^= (const int_vector &v)
 bitwise-xor-update operator More...
 
iterator begin () noexcept
 Iterator that points to the first element of the int_vector. More...
 
iterator end () noexcept
 Iterator that points to the element after the last element of int_vector. More...
 
const_iterator begin () const noexcept
 Const iterator that points to the first element of the int_vector. More...
 
const_iterator end () const noexcept
 Const iterator that points to the element after the last element of int_vector. More...
 
const_iterator cbegin () const noexcept
 Const iterator that points to the first element of the int_vector. More...
 
const_iterator cend () const noexcept
 Const iterator that points to the element after the last element of int_vector. More...
 
void flip ()
 Flip all bits of bit_vector. More...
 
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[] (const size_type &idx) noexcept -> reference
 
auto operator[] (const size_type &idx) noexcept -> reference
 
auto operator[] (const size_type &idx) noexcept -> reference
 
auto operator[] (const size_type &idx) noexcept -> reference
 
auto operator[] (const size_type &idx) const noexcept -> const_reference
 
auto operator[] (const size_type &idx) const noexcept -> const_reference
 
auto operator[] (const size_type &idx) const noexcept -> const_reference
 
auto operator[] (const size_type &idx) const noexcept -> const_reference
 
auto operator[] (const size_type &idx) const noexcept -> const_reference
 
auto operator[] (const size_type &idx) const noexcept -> const_reference
 

Static Public Member Functions

static size_type max_size () noexcept
 Maximum size of the int_vector. More...
 
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. More...
 
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. More...
 

Public Attributes

float growth_factor = 1.5
 Growth factor for amortized constant time operations. More...
 
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
 
template<class container >
bool operator== (const int_vector< t_width > &lhs, const container &rhs) noexcept
 Equality operator for an arbitrary container. More...
 

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 215 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 223 of file int_vector.hpp.

◆ const_pointer

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

Definition at line 227 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 225 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 228 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 235 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 230 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 222 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 226 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 232 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 231 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 224 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 234 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 233 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 229 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 221 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 1425 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 311 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 326 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 1436 of file int_vector.hpp.

◆ int_vector() [6/6]

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

Copy constructor.

Definition at line 1448 of file int_vector.hpp.

◆ ~int_vector()

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

Destructor.

Definition at line 1495 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 491 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 470 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 479 of file int_vector.hpp.

◆ at() [1/2]

template<uint8_t t_width>
reference sdsl::int_vector< t_width >::at ( const size_type 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 665 of file int_vector.hpp.

◆ at() [2/2]

template<uint8_t t_width>
const_reference sdsl::int_vector< t_width >::at ( const size_type 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 671 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 434 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 431 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 767 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 759 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 561 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 1508 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 547 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
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 1598 of file int_vector.hpp.

◆ capacity() [2/7]

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

Definition at line 1605 of file int_vector.hpp.

◆ capacity() [3/7]

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

Definition at line 1612 of file int_vector.hpp.

◆ capacity() [4/7]

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

Definition at line 1619 of file int_vector.hpp.

◆ capacity() [5/7]

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

Definition at line 1626 of file int_vector.hpp.

◆ capacity() [6/7]

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

Definition at line 1633 of file int_vector.hpp.

◆ capacity() [7/7]

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

Definition at line 1640 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 773 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 776 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 1879 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 1853 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 339 of file int_vector.hpp.

◆ data() [1/2]

template<uint8_t t_width>
const uint64_t * 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 566 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 571 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 370 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 440 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 500 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 770 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 764 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 356 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 344 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 779 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 428 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 425 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 1524 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 414 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 386 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 400 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 379 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 1831 of file int_vector.hpp.

◆ max_size()

template<uint8_t t_width>
static 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 542 of file int_vector.hpp.

◆ operator!=()

template<uint8_t t_width>
template<uint8_t t_width2>
bool sdsl::int_vector< t_width >::operator!= ( const int_vector< t_width2 > &  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 721 of file int_vector.hpp.

◆ operator&=()

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

bitwise-and-update operator

Definition at line 1777 of file int_vector.hpp.

◆ operator<()

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

Less operator for two int_vectors.

int_vector w is less than v if

Definition at line 1735 of file int_vector.hpp.

◆ operator<=()

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

Less or equal operator.

Definition at line 1765 of file int_vector.hpp.

◆ operator=() [1/2]

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

Assignment operator.

Parameters
vThe vector v which should be assigned

Definition at line 1466 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 > &&  v)

Move assignment operator.

Definition at line 1477 of file int_vector.hpp.

◆ operator==()

template<uint8_t t_width>
bool sdsl::int_vector< t_width >::operator== ( const int_vector< t_width > &  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 686 of file int_vector.hpp.

◆ operator>()

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

Greater operator for two int_vectors.

int_vector w is greater than v if

Definition at line 1750 of file int_vector.hpp.

◆ operator>=()

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

Greater of equal operator.

Definition at line 1771 of file int_vector.hpp.

◆ operator[]() [1/12]

template<uint8_t t_width>
auto sdsl::int_vector< t_width >::operator[] ( const size_type 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 1686 of file int_vector.hpp.

◆ operator[]() [2/12]

template<uint8_t t_width>
auto sdsl::int_vector< t_width >::operator[] ( const size_type 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 1646 of file int_vector.hpp.

◆ operator[]() [3/12]

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

Definition at line 1693 of file int_vector.hpp.

◆ operator[]() [4/12]

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

Definition at line 1700 of file int_vector.hpp.

◆ operator[]() [5/12]

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

Definition at line 1707 of file int_vector.hpp.

◆ operator[]() [6/12]

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

Definition at line 1714 of file int_vector.hpp.

◆ operator[]() [7/12]

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

Definition at line 1721 of file int_vector.hpp.

◆ operator[]() [8/12]

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

Definition at line 1728 of file int_vector.hpp.

◆ operator[]() [9/12]

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

Definition at line 1655 of file int_vector.hpp.

◆ operator[]() [10/12]

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

Definition at line 1663 of file int_vector.hpp.

◆ operator[]() [11/12]

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

Definition at line 1671 of file int_vector.hpp.

◆ operator[]() [12/12]

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

Definition at line 1679 of file int_vector.hpp.

◆ operator^=()

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

bitwise-xor-update operator

Definition at line 1793 of file int_vector.hpp.

◆ operator|=()

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

bitwise-or-update equal operator

Definition at line 1785 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 455 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 448 of file int_vector.hpp.

◆ read_header()

template<uint8_t t_width>
static 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 789 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 511 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 521 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 527 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 1819 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 1537 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 506 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
inlinenoexcept

The number of elements in the int_vector.

See also
max_size, bit_size, capacity, bit_capacity

Definition at line 1550 of file int_vector.hpp.

◆ size() [2/7]

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

Definition at line 1557 of file int_vector.hpp.

◆ size() [3/7]

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

Definition at line 1564 of file int_vector.hpp.

◆ size() [4/7]

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

Definition at line 1571 of file int_vector.hpp.

◆ size() [5/7]

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

Definition at line 1578 of file int_vector.hpp.

◆ size() [6/7]

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

Definition at line 1585 of file int_vector.hpp.

◆ size() [7/7]

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

Definition at line 1592 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 503 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 595 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 602 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 1801 of file int_vector.hpp.

◆ write_header()

template<uint8_t t_width>
static 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 806 of file int_vector.hpp.

Friends And Related Function Documentation

◆ coder::comma

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

Definition at line 250 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 244 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 246 of file int_vector.hpp.

◆ coder::fibonacci

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

Definition at line 248 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 235 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 235 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 235 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 242 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 235 of file int_vector.hpp.

◆ memory_manager

template<uint8_t t_width>
friend class memory_manager
friend

Definition at line 251 of file int_vector.hpp.

◆ operator==

template<uint8_t t_width>
template<class container >
bool operator== ( const int_vector< t_width > &  lhs,
const container &  rhs 
)
friend

Equality operator for an arbitrary container.

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 708 of file int_vector.hpp.

Member Data Documentation

◆ fixed_int_width

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

Definition at line 252 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 253 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 837 of file int_vector.hpp.


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