|
| bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::NullableAllocatedValue_PointerBitsPair () |
|
| bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::NullableAllocatedValue_PointerBitsPair (t_TYPE *ptr, unsigned flags=0) |
|
bool | bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::equal (const NullableAllocatedValue_PointerBitsPair &other) const |
|
t_TYPE * | bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::getPointer () const |
| Return the held pointer.
|
|
bool | bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::readFlag (unsigned idx) const |
|
void | bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::clearFlag (unsigned idx) |
|
void | bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::setFlag (unsigned idx) |
|
void | bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::setPointer (t_TYPE *new_ptr) |
| Set the held pointer to the value of the specified new_ptr .
|
|
void | bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::swap (NullableAllocatedValue_PointerBitsPair &other) |
|
Outline
Purpose
Provide a mechanism for using the unused bits of a pointer.
Classes
- See also
- bdlb_nullablesllocatedvalue
Description
This private, subordinate component to bdlb_nullableallocatedvalue provides a templated class, bdlb::NullableAllocatedValue_PointerBitsPair
, that allows access to the otherwise unused bits in a pointer to an object. The bdlb::NullableAllocatedValue
class template uses bdlb::NullableAllocatedValue_PointerBitsPair
to store some state about the object in the pointer to allocator
field, saving 4 to 8 bytes (depending on the platform) for each instantiation.
bldb::NullableAllocatedValue_PointerBitsPair
is a non-allocator-aware, value-semantic type.
◆ clearFlag()
template<class t_TYPE , unsigned t_NUM_BITS>
Clear the flag specified by idx
. The behavior is undefined unless idx < t_NUM_BITS
.
◆ equal()
template<class t_TYPE , unsigned t_NUM_BITS>
Return true
if this object and the specified other
have the same value, and false
otherwise. Two NullableAllocatedValue_PointerBitsPair
objects have the same value when their pointer and flags are the same.
◆ getPointer()
template<class t_TYPE , unsigned t_NUM_BITS>
◆ NullableAllocatedValue_PointerBitsPair() [1/2]
template<class t_TYPE , unsigned t_NUM_BITS>
Construct an object holding a null pointer value and all flags set to false.
◆ NullableAllocatedValue_PointerBitsPair() [2/2]
template<class t_TYPE , unsigned t_NUM_BITS>
Construct an object holding the specified ptr
and optionally specified flags
. The behavior is undefined unless flags <= k_Mask
.
◆ readFlag()
template<class t_TYPE , unsigned t_NUM_BITS>
Return the value of the flag specified by idx
. The behavior is undefined unless idx < t_NUM_BITS
.
◆ setFlag()
template<class t_TYPE , unsigned t_NUM_BITS>
Set the flag specified by idx
. The behavior is undefined unless idx < t_NUM_BITS
.
◆ setPointer()
template<class t_TYPE , unsigned t_NUM_BITS>
◆ swap()
template<class t_TYPE , unsigned t_NUM_BITS>
Efficiently exchange the value of this object with the value of the specified other
object. This method provides the no-throw exception-safety guarantee.