BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlb_nullableallocatedvalue_pointerbitspair

Functions

 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)
 

Detailed Description

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.

Function Documentation

◆ clearFlag()

template<class t_TYPE , unsigned t_NUM_BITS>
void bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::clearFlag ( unsigned  idx)
inline

Clear the flag specified by idx. The behavior is undefined unless idx < t_NUM_BITS.

◆ equal()

template<class t_TYPE , unsigned t_NUM_BITS>
bool bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::equal ( const NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS > &  other) const
inline

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>
t_TYPE * bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::getPointer ( ) const
inline

◆ NullableAllocatedValue_PointerBitsPair() [1/2]

template<class t_TYPE , unsigned t_NUM_BITS>
bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::NullableAllocatedValue_PointerBitsPair ( )
inline

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>
bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::NullableAllocatedValue_PointerBitsPair ( t_TYPE *  ptr,
unsigned  flags = 0 
)
inlineexplicit

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>
bool bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::readFlag ( unsigned  idx) const
inline

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>
void bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::setFlag ( unsigned  idx)
inline

Set the flag specified by idx. The behavior is undefined unless idx < t_NUM_BITS.

◆ setPointer()

template<class t_TYPE , unsigned t_NUM_BITS>
void bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::setPointer ( t_TYPE *  new_ptr)
inline

◆ swap()

template<class t_TYPE , unsigned t_NUM_BITS>
void bdlb::NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS >::swap ( NullableAllocatedValue_PointerBitsPair< t_TYPE, t_NUM_BITS > &  other)
inline

Efficiently exchange the value of this object with the value of the specified other object. This method provides the no-throw exception-safety guarantee.