KTL
ktl::packed_ptr< PtrT, Bits, Alignment > Class Template Reference

A packed pointer-like type which takes advantage of any bits that don't get used due to alignment. More...

#include <packed_ptr.h>

Public Member Functions

 packed_ptr () noexcept
 
template<typename Int >
 packed_ptr (PtrT p, Int value) noexcept
 
 operator bool () const noexcept
 
PtrT get_ptr () const noexcept
 
template<typename Int >
Int get_int () const noexcept
 
void set_ptr (PtrT p) noexcept
 
template<typename Int >
void set_int (Int value) noexcept
 

Static Public Attributes

static constexpr uintmax_t FREE_BITS = detail::log2(Alignment)
 

Detailed Description

template<typename PtrT, size_t Bits, size_t Alignment>
class ktl::packed_ptr< PtrT, Bits, Alignment >

A packed pointer-like type which takes advantage of any bits that don't get used due to alignment.

Template Parameters
PtrTThe pointer type to use

Constructor & Destructor Documentation

◆ packed_ptr() [1/2]

template<typename PtrT , size_t Bits, size_t Alignment>
ktl::packed_ptr< PtrT, Bits, Alignment >::packed_ptr ( )
inlinenoexcept

◆ packed_ptr() [2/2]

template<typename PtrT , size_t Bits, size_t Alignment>
template<typename Int >
ktl::packed_ptr< PtrT, Bits, Alignment >::packed_ptr ( PtrT  p,
Int  value 
)
inlineexplicitnoexcept

Member Function Documentation

◆ get_int()

template<typename PtrT , size_t Bits, size_t Alignment>
template<typename Int >
Int ktl::packed_ptr< PtrT, Bits, Alignment >::get_int ( ) const
inlinenoexcept

◆ get_ptr()

template<typename PtrT , size_t Bits, size_t Alignment>
PtrT ktl::packed_ptr< PtrT, Bits, Alignment >::get_ptr ( ) const
inlinenoexcept

◆ operator bool()

template<typename PtrT , size_t Bits, size_t Alignment>
ktl::packed_ptr< PtrT, Bits, Alignment >::operator bool ( ) const
inlineexplicitnoexcept

◆ set_int()

template<typename PtrT , size_t Bits, size_t Alignment>
template<typename Int >
void ktl::packed_ptr< PtrT, Bits, Alignment >::set_int ( Int  value)
inlinenoexcept

◆ set_ptr()

template<typename PtrT , size_t Bits, size_t Alignment>
void ktl::packed_ptr< PtrT, Bits, Alignment >::set_ptr ( PtrT  p)
inlinenoexcept

Member Data Documentation

◆ FREE_BITS

template<typename PtrT , size_t Bits, size_t Alignment>
constexpr uintmax_t ktl::packed_ptr< PtrT, Bits, Alignment >::FREE_BITS = detail::log2(Alignment)
staticconstexpr

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