BDE 4.14.0 Production release
|
#include <bslstl_stack.h>
Public Types | |
typedef CONTAINER::value_type | value_type |
typedef CONTAINER::reference | reference |
typedef CONTAINER::const_reference | const_reference |
typedef CONTAINER::size_type | size_type |
typedef CONTAINER | container_type |
Public Member Functions | |
BSLMF_NESTED_TRAIT_DECLARATION_IF (stack, BloombergLP::bslma::UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator< container_type >::value) | |
stack () | |
stack (const stack &original) | |
stack (BloombergLP::bslmf::MovableRef< stack > original) | |
stack (const CONTAINER &container) | |
stack (BloombergLP::bslmf::MovableRef< CONTAINER > container) | |
template<class ALLOCATOR > | |
stack (const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
template<class ALLOCATOR > | |
stack (const CONTAINER &container, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
template<class ALLOCATOR > | |
stack (const stack &original, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
template<class ALLOCATOR > | |
stack (BloombergLP::bslmf::MovableRef< CONTAINER > container, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
template<class ALLOCATOR > | |
stack (BloombergLP::bslmf::MovableRef< stack > original, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
stack & | operator= (const stack &rhs) |
stack & | operator= (BloombergLP::bslmf::MovableRef< stack > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false) |
template<class... Args> | |
reference | emplace (Args &&... args) |
void | pop () |
void | push (const value_type &value) |
Push the specified value onto the top of this stack. | |
void | push (BloombergLP::bslmf::MovableRef< value_type > value) |
bool | empty () const |
size_type | size () const |
Return the number of elements contained in this stack. | |
const_reference | top () const |
Public Attributes | |
void swap(stack &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl reference | top () |
Protected Attributes | |
container_type | c |
Friends | |
template<class VAL , class CONT > | |
bool | operator== (const stack< VAL, CONT > &, const stack< VAL, CONT > &) |
template<class VAL , class CONT > | |
bool | operator!= (const stack< VAL, CONT > &, const stack< VAL, CONT > &) |
template<class VAL , class CONT > | |
bool | operator< (const stack< VAL, CONT > &, const stack< VAL, CONT > &) |
template<class VAL , class CONT > | |
bool | operator> (const stack< VAL, CONT > &, const stack< VAL, CONT > &) |
template<class VAL , class CONT > | |
bool | operator<= (const stack< VAL, CONT > &, const stack< VAL, CONT > &) |
template<class VAL , class CONT > | |
bool | operator>= (const stack< VAL, CONT > &, const stack< VAL, CONT > &) |
This class
defines a container adapter which supports access primarily via push
, pop
, and top
. This type can be based on a variety of other container types, including deque
, vector
, and list
. This type is value-semantic if the supporting CONTAINER
and VALUE
are value-semantic.
Note that we never use VALUE
in the implementation except in the default argument of CONTAINER
. We use CONTAINER::value_type
for everything, which means that if CONTAINER
is specified, then VALUE
is ignored.
See bslstl_stack
typedef CONTAINER::const_reference bsl::stack< VALUE, CONTAINER >::const_reference |
typedef CONTAINER bsl::stack< VALUE, CONTAINER >::container_type |
typedef CONTAINER::reference bsl::stack< VALUE, CONTAINER >::reference |
typedef CONTAINER::size_type bsl::stack< VALUE, CONTAINER >::size_type |
typedef CONTAINER::value_type bsl::stack< VALUE, CONTAINER >::value_type |
|
inlineexplicit |
Create an empty stack. No allocator will be provided to the underlying container. That container's memory allocation will be provided by the default allocator of its type.
|
inline |
Create a stack having the value of the specified original
. The currently installed default allocator is used to supply memory.
|
inline |
Create a stack having the value of the specified original
by moving the contents of original
to the new stack. The allocator associated with original
is propagated for use in the new stack. original
is left in a valid but unspecified state.
|
inlineexplicit |
Create a stack whose underlying container has the value of the specified container
. The currently installed default allocator is used to supply memory.
|
inlineexplicit |
Create a stack whose underlying container has the value of the specified container
(on entry) by moving the contents of container
to the new stack. The allocator associated with container
is propagated for use in the new stack. container
is left in a valid but unspecified state.
|
inlineexplicit |
Create an empty stack, and use the specified basicAllocator
to supply memory. If CONTAINER::allocator_type
does not exist, this constructor may not be used.
|
inline |
Create a stack whose underlying container has the value of the specified container
, and use the specified basicAllocator
to supply memory. If CONTAINER::allocator_type
does not exist, this constructor may not be used.
|
inline |
Create a stack having the value of the specified stack original
and use the specified basicAllocator
to supply memory. If CONTAINER::allocator_type
does not exist, this constructor may not be used.
|
inline |
Create a stack whose underlying container has the value of the specified container
(on entry) that uses basicAllocator
to supply memory by using the allocator-extended move constructor of CONTAINER.
container' is left in a valid but unspecified state. A bslma::Allocator *
can be supplied for basicAllocator
if the (template parameter) ALLOCATOR
is bsl::allocator
(the default). This method assumes that CONTAINER
has a move constructor. If CONTAINER::allocator_type
does not exist, this constructor may not be used.
|
inline |
Create a stack having the value of the specified original
(on entry) that uses basicAllocator
to supply memory by using the allocator-extended moved constructor of CONTAINER
. original
is left in a valid but unspecified state. Note that a bslma::Allocator *
can be supplied for basicAllocator
if the (template parameter) ALLOCATOR
is bsl::allocator
(the default). Also note that this method assumes that CONTAINER
has a move constructor. Also note that if CONTAINER::allocator_type
does not exist, this constructor may not be used.
bsl::stack< VALUE, CONTAINER >::BSLMF_NESTED_TRAIT_DECLARATION_IF | ( | stack< VALUE, CONTAINER > | , |
BloombergLP::bslma::UsesBslmaAllocator | , | ||
BloombergLP::bslma::UsesBslmaAllocator< container_type >::value | |||
) |
|
inline |
Push onto this stack a newly created value_type
object constructed by forwarding get_allocator()
(if required) and the specified (variable number of) args
to the corresponding constructor of value_type
. Return a reference providing modifiable access to the inserted element.
|
inline |
Return true
if this stack contains no elements and false
otherwise.
|
inline |
Assign to this object the value of the specified rhs
object, and return a reference providing modifiable access to this object. The contents of rhs
are moved to this stack using the move-assignment operator of CONTAINER
. rhs
is left in a valid but unspecified state, and if an exception is thrown, *this
is left in a valid but unspecified state.
|
inline |
Assign to this object the value of the specified rhs
object, and return a reference providing modifiable access to this object.
|
inline |
Remove the top element from this stack. The behavior is undefined if this stack is empty.
|
inline |
Push onto this stack a value_type
object having the value of the specified value
(on entry) by moving the contents of value
to the new object on this stack. value
is left in a valid but unspecified state.
|
inline |
|
inline |
const_reference bsl::stack< VALUE, CONTAINER >::top | ( | ) | const |
Return a reference providing non-modifiable access to the element at the top of this stack. The behavior is undefined if the stack is empty.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
|
inline |
Exchange the value of this stack with the value of the specified other
stack. Return a reference to the element at the top of this stack. The behavior is undefined if this stack is empty.