Store a vector of values using a specific number of bits for each value. Both signed and unsigned types can be used, e.g

Synopsis

Declared in <llvm/ADT/PackedVector.h>

template<
    typename T,
    unsigned int BitNum,
    typename BitVectorTy = BitVector>
class PackedVector;

Description

PackedVector<signed, 2> vec;

will create a vector accepting values ‐2, ‐1, 0, 1. Any other value will hit an assertion.

Types

Name

Description

reference

Proxy that reads and writes a single packed element by index.

Member Functions

Name

Description

PackedVector [constructor]

Constructors

clear

Remove all elements and release bit storage.

empty

Return true if the vector contains no elements.

operator[]

Subscript operators

operator|=

Bitwise‐or each packed bit with the corresponding bit in RHS.

push_back

Append val as a new packed element.

raw_bits

Access the underlying bit vector used for packed storage.

reserve

Reserve bit capacity for at least N packed elements.

reset

Clear every packed bit without changing the element count.

resize

Change the number of packed elements to N, growing or shrinking bits.

size

Return the number of packed elements.

operator==

Return true if both vectors have identical packed bit patterns.

operator!=

Return true if the packed bit patterns differ.

Created with MrDocs