tetl 0.1.0
Embedded Template Library
|
This struct implements a pair of a pointer and small integer. It is designed to represent this in the space required by one pointer by bitmangling the integer into the low part of the pointer. This can only be done for small integers: typically up to 3 bits, but it depends on the number of bits available according to pointer_like_traits for the type. More...
#include <pointer_int_pair.hpp>
Public Types | |
using | int_type = IntType |
using | pointer_info = Info |
using | pointer_traits = PtrTraits |
using | pointer_type = PointerT |
Public Member Functions | |
constexpr | pointer_int_pair ()=default |
pointer_int_pair (pointer_type pointerValue) | |
pointer_int_pair (pointer_type pointerValue, int_type intValue) | |
auto | get_addr_of_pointer () -> pointer_type * |
auto | get_addr_of_pointer () const -> pointer_type const * |
auto | get_int () const -> int_type |
auto | get_opaque_value () const -> void * |
auto | get_pointer () const -> pointer_type |
void | set_from_opaque_value (void *val) |
void | set_int (int_type intValue) |
void | set_pointer (pointer_type pointerValue) |
void | set_ptr_and_int (pointer_type pointerValue, int_type intValue) |
Static Public Member Functions | |
static auto | get_from_opaque_value (void *v) -> pointer_int_pair |
static auto | get_from_opaque_value (void const *v) -> pointer_int_pair |
Allow pointer_int_pairs to be created from const void * if and only if the pointer type could be created from a const void *. | |
Static Public Attributes | |
static constexpr auto | int_bits = IntBits |
Friends | |
auto | operator!= (pointer_int_pair const &lhs, pointer_int_pair const &rhs) -> bool |
auto | operator< (pointer_int_pair const &lhs, pointer_int_pair const &rhs) -> bool |
auto | operator<= (pointer_int_pair const &lhs, pointer_int_pair const &rhs) -> bool |
auto | operator== (pointer_int_pair const &lhs, pointer_int_pair const &rhs) -> bool |
auto | operator> (pointer_int_pair const &lhs, pointer_int_pair const &rhs) -> bool |
auto | operator>= (pointer_int_pair const &lhs, pointer_int_pair const &rhs) -> bool |
This struct implements a pair of a pointer and small integer. It is designed to represent this in the space required by one pointer by bitmangling the integer into the low part of the pointer. This can only be done for small integers: typically up to 3 bits, but it depends on the number of bits available according to pointer_like_traits for the type.
Note that pointer_int_pair always puts the IntVal part in the highest bits possible. For example, pointer_int_pair<void*, 1, bool> will put the bit for the bool into bit #2, not bit #0, which allows the low two bits to be used for something else. For example, this allows: pointer_int_pair<pointer_int_pair<void*, 1, bool>, 1, bool> ... and the two bools will land in different bits.
using int_type = IntType |
using pointer_info = Info |
using pointer_traits = PtrTraits |
using pointer_type = PointerT |
|
constexprdefault |
|
inline |
|
inlineexplicit |
|
inline |
|
inlinenodiscard |
|
inlinestatic |
|
inlinestatic |
Allow pointer_int_pairs to be created from const void * if and only if the pointer type could be created from a const void *.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
staticconstexpr |