A generic interface for classes that have size (the current number of elements) and capacity (the number of elements that can be added before a reallocation happens).
virtual void sux::util::Expandable::grow |
( |
size_t |
capacity | ) |
|
|
pure virtual |
Enlarges this expandable so that it can contain a given number of elements, plus possibly extra space.
If the current capacity is sufficient, nothing happens. Otherwise, the expandable is enlarged, usually to the maximum between the provided capacity and 50% more than the current capacity.
- Parameters
-
capacity | the desired new capacity. |
Implemented in sux::util::FenwickByteL< BOUND, AT >, sux::util::FenwickBitL< BOUND, AT >, sux::util::FenwickFixedL< BOUND, AT >, sux::util::FenwickByteF< BOUND, AT >, sux::util::FenwickFixedF< BOUND, AT >, sux::util::FenwickBitF< BOUND, AT >, sux::util::Vector< T, AT >, sux::util::Vector< uint64_t, AT >, sux::util::Vector< uint8_t, AT >, and sux::util::Vector< int64_t, AT >.
virtual void sux::util::Expandable::reserve |
( |
size_t |
capacity | ) |
|
|
pure virtual |
Enlarges this expandable so that it can contain a given number of elements without memory reallocation.
If the current capacity is sufficient, nothing happens. Otherwise, the expandable is enlarged to the provided capacity.
- Parameters
-
capacity | the desired new capacity. |
Implemented in sux::util::FenwickByteL< BOUND, AT >, sux::util::FenwickBitL< BOUND, AT >, sux::util::FenwickFixedL< BOUND, AT >, sux::util::FenwickByteF< BOUND, AT >, sux::util::FenwickFixedF< BOUND, AT >, sux::util::FenwickBitF< BOUND, AT >, sux::util::Vector< T, AT >, sux::util::Vector< uint64_t, AT >, sux::util::Vector< uint8_t, AT >, and sux::util::Vector< int64_t, AT >.
virtual void sux::util::Expandable::resize |
( |
size_t |
size | ) |
|
|
pure virtual |
Changes the expandable size to the given value.
If the argument is smaller than or equal to the current size, there is no memory reallocation. Otherwise, reallocation happens with grow().
- Parameters
-
size | the desired new size. |
Implemented in sux::util::FenwickByteL< BOUND, AT >, sux::util::FenwickBitL< BOUND, AT >, sux::util::FenwickFixedL< BOUND, AT >, sux::util::FenwickByteF< BOUND, AT >, sux::util::FenwickBitF< BOUND, AT >, sux::util::FenwickFixedF< BOUND, AT >, sux::util::Vector< T, AT >, sux::util::Vector< uint64_t, AT >, sux::util::Vector< uint8_t, AT >, and sux::util::Vector< int64_t, AT >.