LLVM  8.0.1
Classes | Public Member Functions | Friends | List of all members
llvm::PointerEmbeddedInt< IntT, Bits > Class Template Reference

Utility to embed an integer into a pointer-like type. More...

#include "llvm/ADT/PointerEmbeddedInt.h"

Public Member Functions

 PointerEmbeddedInt ()=default
 
 PointerEmbeddedInt (IntT I)
 
PointerEmbeddedIntoperator= (IntT I)
 
 operator IntT () const
 

Friends

struct PointerLikeTypeTraits< PointerEmbeddedInt >
 

Detailed Description

template<typename IntT, int Bits = sizeof(IntT) * CHAR_BIT>
class llvm::PointerEmbeddedInt< IntT, Bits >

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

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.

Definition at line 34 of file PointerEmbeddedInt.h.

Constructor & Destructor Documentation

◆ PointerEmbeddedInt() [1/2]

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
llvm::PointerEmbeddedInt< IntT, Bits >::PointerEmbeddedInt ( )
default

◆ PointerEmbeddedInt() [2/2]

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
llvm::PointerEmbeddedInt< IntT, Bits >::PointerEmbeddedInt ( IntT  I)
inline

Definition at line 62 of file PointerEmbeddedInt.h.

References I.

Member Function Documentation

◆ operator IntT()

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
llvm::PointerEmbeddedInt< IntT, Bits >::operator IntT ( ) const
inline

Definition at line 73 of file PointerEmbeddedInt.h.

◆ operator=()

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
PointerEmbeddedInt& llvm::PointerEmbeddedInt< IntT, Bits >::operator= ( IntT  I)
inline

Definition at line 64 of file PointerEmbeddedInt.h.

References assert(), and I.

Friends And Related Function Documentation

◆ PointerLikeTypeTraits< PointerEmbeddedInt >

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
friend struct PointerLikeTypeTraits< PointerEmbeddedInt >
friend

Definition at line 55 of file PointerEmbeddedInt.h.


The documentation for this class was generated from the following file: