BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR > Class Template Reference

#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.
 

Detailed Description

template<class VALUE_TYPE, class ALLOCATOR>
class bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >

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

Constructor & Destructor Documentation

◆ Deque_Guard()

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::Deque_Guard ( deque< VALUE_TYPE, ALLOCATOR > *  deque,
bool  isTail 
)
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.

◆ ~Deque_Guard()

template<class VALUE_TYPE , class ALLOCATOR >
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.

Member Function Documentation

◆ begin()

template<class VALUE_TYPE , class ALLOCATOR >
Deque_Guard< VALUE_TYPE, ALLOCATOR >::IteratorImp bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::begin ( ) const
inline

◆ count()

template<class VALUE_TYPE , class ALLOCATOR >
std::size_t bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::count ( ) const
inline

◆ end()

template<class VALUE_TYPE , class ALLOCATOR >
Deque_Guard< VALUE_TYPE, ALLOCATOR >::IteratorImp bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::end ( ) const
inline

◆ operator++()

template<class VALUE_TYPE , class ALLOCATOR >
std::size_t bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::operator++ ( )
inline

◆ operator--()

template<class VALUE_TYPE , class ALLOCATOR >
std::size_t bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::operator-- ( )
inline

◆ release()

template<class VALUE_TYPE , class ALLOCATOR >
void bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::release ( )
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.


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