BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR > Class Template Reference

#include <bslalg_autoarraymovedestructor.h>

Public Member Functions

 AutoArrayMoveDestructor (OBJECT_TYPE *destination, OBJECT_TYPE *begin, OBJECT_TYPE *middle, OBJECT_TYPE *end, ALLOCATOR allocator=ALLOCATOR())
 
 ~AutoArrayMoveDestructor ()
 
void advance ()
 
OBJECT_TYPE * begin () const
 Return the address at the beginning of the guarded range.
 
OBJECT_TYPE * destination () const
 
OBJECT_TYPE * end () const
 Return the address at the end of the guarded range.
 
OBJECT_TYPE * middle () const
 Return the address at the middle of the guarded range.
 

Detailed Description

template<class OBJECT_TYPE, class ALLOCATOR = bsl::allocator<OBJECT_TYPE>>
class bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR >

This class provides a specialized proctor object that, upon destruction and unless the release method has been called, bit-wise moves the elements in a segment of an array of parameterized OBJECT_TYPE back to some destination, and destroys some other elements in an adjacent segment of the same array. The elements destroyed are delimited by the range [ begin(), middle() ) and those moved to destination() and in the range [ middle(), end() ). Note that, once constructed, begin() and end() remain fixed. As the guard advances, middle() and destination() move, reflecting the successful transfer of data between the moving range and the destination.

See bslalg_autoarraymovedestructor

Constructor & Destructor Documentation

◆ AutoArrayMoveDestructor()

template<class OBJECT_TYPE , class ALLOCATOR >
bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR >::AutoArrayMoveDestructor ( OBJECT_TYPE *  destination,
OBJECT_TYPE *  begin,
OBJECT_TYPE *  middle,
OBJECT_TYPE *  end,
ALLOCATOR  allocator = ALLOCATOR() 
)
inline

TBD: document the allocator parameter. Create a proctor for the sequence of elements of the parameterized OBJECT_TYPE in the specified range [ begin, end ) which, upon destruction, moves the range [ begin, middle ) to the specified destination and destroys the [ middle, end ) range. The behavior is undefined unless begin, middle, and end refer to a contiguous sequence of initialized OBJECT_TYPE objects, where begin <= middle <= end, and destination refers to a contiguous sequence of (uninitialized) memory of sufficient size to hold end - begin OBJECT_TYPE objects (which must not overlap [begin, end)).

◆ ~AutoArrayMoveDestructor()

template<class OBJECT_TYPE , class ALLOCATOR >
bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR >::~AutoArrayMoveDestructor ( )

Bit-wise move the range [ middle(), end() ) to the destination() address and destroy [ begin(), middle() ).

Member Function Documentation

◆ advance()

template<class OBJECT_TYPE , class ALLOCATOR >
void bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR >::advance ( )
inline

Increment both middle and destination pointers by one position. The behavior is undefined if this operation result in destination() entering the [ begin(), end() ) range.

◆ begin()

template<class OBJECT_TYPE , class ALLOCATOR >
OBJECT_TYPE * bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR >::begin ( ) const
inline

◆ destination()

template<class OBJECT_TYPE , class ALLOCATOR >
OBJECT_TYPE * bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR >::destination ( ) const
inline

Return the destination address, to which the second portion of the guarded range, delimited by [ middle(), end() ), will be moved upon destruction, or 0 if this guard has been released.

◆ end()

template<class OBJECT_TYPE , class ALLOCATOR >
OBJECT_TYPE * bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR >::end ( ) const
inline

◆ middle()

template<class OBJECT_TYPE , class ALLOCATOR >
OBJECT_TYPE * bslalg::AutoArrayMoveDestructor< OBJECT_TYPE, ALLOCATOR >::middle ( ) const
inline

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