cptr::tagged_ptr

A compressed pointer with TagBits small tag bits stored in its alignment bits, all in 4 bytes. T must be aligned to 2^(TagBits + Cage::shift).

Synopsis

Declared in <cptr/pack.hpp>

template<
    class T,
    unsigned int TagBits,
    class Cage = default_cage>
class tagged_ptr;

Member Functions

NameDescription
tagged_ptr [constructor]Constructors
get The pointer without the tag, or nullptr. Constant-evaluable when null.
set Replaces both. p must be null or point into the cage, aligned to 2^(TagBits + Cage::shift), and tag must fit in TagBits bits (both checked by assertions in debug builds).
tag The tag, below 2^TagBits.

Friends

NameDescription
cptr::operator==Same pointer and same tag.