Utility to embed an integer into a pointer‐like type.

Synopsis

Declared in <llvm/ADT/PointerEmbeddedInt.h>

template<
    typename IntT,
    int Bits = sizeof(IntT) * 8>
class PointerEmbeddedInt;

Description

This is specifically intended to allow embedding integers where fewer bits are required than exist in a pointer, and the integer can participate in abstractions along side other pointer‐like types. For example it can be placed into a PointerSumType or PointerUnion.

Note that much like pointers, an integer value of zero has special utility due to boolean conversions. For example, a non‐null value can be tested for in the above abstractions without testing the particular active member. Also, the default constructed value zero initializes the integer.

Member Functions

Name

Description

PointerEmbeddedInt [constructor]

Constructors

operator=

Embed integer I, asserting it fits in the reserved Bits.

operator IntT

Extract the embedded integer value.

Friends

Name

Description

llvm::PointerLikeTypeTraits

A traits type that is used to handle pointer types and things that are just wrappers for pointers as a uniform entity.

Created with MrDocs