Bitcoin ABC 0.30.5
P2P Digital Currency
|
Class that mimics std::deque<bool>, but with std::vector<bool>'s bit packing. More...
#include <bitdeque.h>
Classes | |
class | Iterator |
Iterator to a bitdeque element, const or not. More... | |
Public Types | |
using | value_type = bool |
using | size_type = std::size_t |
using | difference_type = typename deque_type::difference_type |
using | reference = typename word_type::reference |
using | const_reference = bool |
using | iterator = Iterator< false > |
using | const_iterator = Iterator< true > |
using | pointer = void |
using | const_pointer = void |
using | reverse_iterator = std::reverse_iterator< iterator > |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
Public Member Functions | |
bitdeque () | |
Construct an empty container. More... | |
void | assign (size_type count, bool val) |
Set the container equal to count times the value of val. More... | |
bitdeque (size_type count, bool val) | |
Construct a container containing count times the value of val. More... | |
bitdeque (size_t count) | |
Construct a container containing count false values. More... | |
bitdeque (const bitdeque &)=default | |
Copy constructor. More... | |
bitdeque (bitdeque &&) noexcept=default | |
Move constructor. More... | |
bitdeque & | operator= (const bitdeque &other)=default |
Copy assignment operator. More... | |
bitdeque & | operator= (bitdeque &&other) noexcept=default |
Move assignment operator. More... | |
iterator | begin () noexcept |
iterator | end () noexcept |
const_iterator | begin () const noexcept |
const_iterator | cbegin () const noexcept |
const_iterator | end () const noexcept |
const_iterator | cend () const noexcept |
reverse_iterator | rbegin () noexcept |
reverse_iterator | rend () noexcept |
const_reverse_iterator | rbegin () const noexcept |
const_reverse_iterator | crbegin () const noexcept |
const_reverse_iterator | rend () const noexcept |
const_reverse_iterator | crend () const noexcept |
size_type | size () const noexcept |
Count the number of bits in the container. More... | |
bool | empty () const noexcept |
Determine whether the container is empty. More... | |
size_type | max_size () const noexcept |
Return the maximum size of the container. More... | |
template<typename It > | |
void | assign (It first, It last) |
Set the container equal to the bits in [first,last). More... | |
void | assign (std::initializer_list< bool > ilist) |
Set the container equal to the bits in ilist. More... | |
bitdeque & | operator= (std::initializer_list< bool > ilist) |
Set the container equal to the bits in ilist. More... | |
template<typename It > | |
bitdeque (It first, It last) | |
Construct a container containing the bits in [first,last). More... | |
bitdeque (std::initializer_list< bool > ilist) | |
Construct a container containing the bits in ilist. More... | |
reference | at (size_type position) |
const_reference | at (size_type position) const |
reference | operator[] (size_type position) |
const_reference | operator[] (size_type position) const |
reference | front () |
const_reference | front () const |
reference | back () |
const_reference | back () const |
void | shrink_to_fit () |
Release unused memory. More... | |
void | clear () noexcept |
Empty the container. More... | |
void | push_back (bool val) |
reference | emplace_back (bool val) |
void | push_front (bool val) |
reference | emplace_front (bool val) |
void | pop_back () |
void | pop_front () |
void | resize (size_type n) |
Resize the container. More... | |
void | swap (bitdeque &other) noexcept |
iterator | erase (const_iterator first, const_iterator last) |
iterator | erase (iterator first, iterator last) |
iterator | erase (const_iterator pos) |
iterator | erase (iterator pos) |
iterator | insert (const_iterator pos, bool val) |
iterator | emplace (const_iterator pos, bool val) |
iterator | insert (const_iterator pos, size_type count, bool val) |
template<typename It > | |
iterator | insert (const_iterator pos, It first, It last) |
Private Types | |
using | word_type = std::bitset< BlobSize > |
using | deque_type = std::deque< word_type > |
Private Member Functions | |
void | erase_back (size_type n) |
Shrink the container by n bits, removing from the end. More... | |
void | extend_back (size_type n) |
Extend the container by n bits, adding at the end. More... | |
void | erase_front (size_type n) |
Shrink the container by n bits, removing from the beginning. More... | |
void | extend_front (size_type n) |
Extend the container by n bits, adding at the beginning. More... | |
void | insert_zeroes (size_type before, size_type count) |
Insert a sequence of falses anywhere in the container. More... | |
Private Attributes | |
deque_type | m_deque |
Deque of bitsets storing the actual bit data. More... | |
int | m_pad_begin |
Number of unused bits at the front of m_deque.front(). More... | |
int | m_pad_end |
Number of unused bits at the back of m_deque.back(). More... | |
Static Private Attributes | |
static constexpr int | BITS_PER_WORD = BlobSize |
Friends | |
template<bool Const> | |
class | Iterator |
void | swap (bitdeque &b1, bitdeque &b2) noexcept |
Class that mimics std::deque<bool>, but with std::vector<bool>'s bit packing.
BlobSize selects the (minimum) number of bits that are allocated at once. Larger values reduce the asymptotic memory usage overhead, at the cost of needing larger up-front allocations. The default is 4096 bytes.
Definition at line 22 of file bitdeque.h.
Definition at line 166 of file bitdeque.h.
using bitdeque< BlobSize >::const_pointer = void |
Definition at line 168 of file bitdeque.h.
using bitdeque< BlobSize >::const_reference = bool |
Definition at line 164 of file bitdeque.h.
using bitdeque< BlobSize >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 170 of file bitdeque.h.
|
private |
Definition at line 25 of file bitdeque.h.
using bitdeque< BlobSize >::difference_type = typename deque_type::difference_type |
Definition at line 162 of file bitdeque.h.
Definition at line 165 of file bitdeque.h.
using bitdeque< BlobSize >::pointer = void |
Definition at line 167 of file bitdeque.h.
using bitdeque< BlobSize >::reference = typename word_type::reference |
Definition at line 163 of file bitdeque.h.
using bitdeque< BlobSize >::reverse_iterator = std::reverse_iterator<iterator> |
Definition at line 169 of file bitdeque.h.
using bitdeque< BlobSize >::size_type = std::size_t |
Definition at line 161 of file bitdeque.h.
using bitdeque< BlobSize >::value_type = bool |
Definition at line 160 of file bitdeque.h.
|
private |
Definition at line 24 of file bitdeque.h.
|
inlineexplicit |
Construct an empty container.
Definition at line 257 of file bitdeque.h.
|
inline |
Construct a container containing count times the value of val.
Definition at line 275 of file bitdeque.h.
|
inlineexplicit |
Construct a container containing count false values.
Definition at line 278 of file bitdeque.h.
|
default |
Copy constructor.
|
defaultnoexcept |
Move constructor.
|
inline |
Construct a container containing the bits in [first,last).
Definition at line 371 of file bitdeque.h.
|
inline |
Construct a container containing the bits in ilist.
Definition at line 374 of file bitdeque.h.
|
inline |
Set the container equal to the bits in [first,last).
Definition at line 345 of file bitdeque.h.
|
inline |
Set the container equal to count times the value of val.
Definition at line 260 of file bitdeque.h.
|
inline |
Set the container equal to the bits in ilist.
Definition at line 355 of file bitdeque.h.
|
inline |
Definition at line 395 of file bitdeque.h.
|
inline |
|
inlinenoexcept |
Definition at line 295 of file bitdeque.h.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Empty the container.
Definition at line 402 of file bitdeque.h.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
Determine whether the container is empty.
Definition at line 328 of file bitdeque.h.
|
inlinenoexcept |
Definition at line 301 of file bitdeque.h.
|
inline |
Definition at line 455 of file bitdeque.h.
|
inline |
Definition at line 473 of file bitdeque.h.
|
inlineprivate |
Shrink the container by n bits, removing from the end.
Definition at line 183 of file bitdeque.h.
|
inlineprivate |
Shrink the container by n bits, removing from the beginning.
Definition at line 213 of file bitdeque.h.
|
inlineprivate |
Extend the container by n bits, adding at the end.
Definition at line 202 of file bitdeque.h.
|
inlineprivate |
Extend the container by n bits, adding at the beginning.
Definition at line 232 of file bitdeque.h.
Definition at line 393 of file bitdeque.h.
|
inline |
|
inline |
Definition at line 479 of file bitdeque.h.
|
inline |
|
inline |
|
inlineprivate |
Insert a sequence of falses anywhere in the container.
Definition at line 243 of file bitdeque.h.
Return the maximum size of the container.
Definition at line 335 of file bitdeque.h.
|
defaultnoexcept |
Move assignment operator.
|
default |
Copy assignment operator.
|
inline |
Set the container equal to the bits in ilist.
Definition at line 365 of file bitdeque.h.
|
inline |
|
inline |
|
inline |
Definition at line 435 of file bitdeque.h.
|
inline |
Definition at line 408 of file bitdeque.h.
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Resize the container.
Definition at line 438 of file bitdeque.h.
|
inline |
Release unused memory.
Definition at line 399 of file bitdeque.h.
Count the number of bits in the container.
Definition at line 323 of file bitdeque.h.
|
inlinenoexcept |
Definition at line 447 of file bitdeque.h.
Definition at line 31 of file bitdeque.h.
|
friend |
Definition at line 452 of file bitdeque.h.
|
staticconstexprprivate |
Definition at line 27 of file bitdeque.h.
|
private |
Deque of bitsets storing the actual bit data.
Definition at line 174 of file bitdeque.h.
|
private |
Number of unused bits at the front of m_deque.front().
Definition at line 177 of file bitdeque.h.
|
private |
Number of unused bits at the back of m_deque.back().
Definition at line 180 of file bitdeque.h.