BDE 4.14.0 Production release
|
#include <bslstl_deque.h>
Public Member Functions | |
Deque_Guard (deque< VALUE_TYPE, ALLOCATOR > *deque, bool isTail) | |
~Deque_Guard () | |
std::size_t | operator++ () |
Increment the count of this guard, and return the new count. | |
std::size_t | operator-- () |
Decrement the count of this guard, and return the new count. | |
void | release () |
std::size_t | count () const BSLS_KEYWORD_NOEXCEPT |
Return the current count maintained by this guard. | |
IteratorImp | begin () const BSLS_KEYWORD_NOEXCEPT |
Return a pointer after the first item in the guarded range. | |
IteratorImp | end () const BSLS_KEYWORD_NOEXCEPT |
Return a pointer after the last item in the guarded range. | |
This class provides a proctor that maintains a count of the number of elements constructed at the front or back of a deque, but not yet committed to the deque's range of valid elements; if the count is non-zero at destruction, the destructor destroys the elements in the range [d_deque_p->end() .. d_deque_p->end() + d_count)
, or the range [d_deque_p->begin() - d_count .. d_deque_p->begin())
, depending on whether this proctor guards the back or front. This guard is used to undo element constructors in the event of an exception. It is up to the client code to increment the count whenever a new element is constructed and to decrement the count whenever d_start
or d_finish
of the guarded deque is moved to incorporate more elements.
See bslstl_deque
|
inline |
Initializes object to guard 0 items from the specified deque
. This guards either the tail or the head, as determined by the specified isTail
boolean.
bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::~Deque_Guard | ( | ) |
Call the (template parameter) VALUE_TYPE
destructor on objects in the range [d.end() .. d.end() + count())
if isTail
was specified as true
during construction, or [d.start() - count() .. d.start()]
if isTail
was specified as false
during construction, where d
is the deque used to construct this guard.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set the count of this guard to 0. Note that this guard's destructor will do nothing if count is not incremented again after this call.