8#ifndef INCLUDED_BSLSTL_STACK
9#define INCLUDED_BSLSTL_STACK
341#include <bslscm_version.h>
366#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
370# define COMPILING_BSLSTL_STACK_H
372# undef COMPILING_BSLSTL_STACK_H
393template <
class VALUE,
class CONTAINER = deque<VALUE> >
396#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
406 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
424 template <
class VAL,
class CONT>
426 template <
class VAL,
class CONT>
428 template <
class VAL,
class CONT>
430 template <
class VAL,
class CONT>
432 template <
class VAL,
class CONT>
434 template <
class VAL,
class CONT>
436#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
437 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
438 template <
class VAL, three_way_comparable CONT>
439 friend compare_three_way_result_t<CONT>
447 BloombergLP::bslma::UsesBslmaAllocator,
448 BloombergLP::bslma::UsesBslmaAllocator<container_type>::value);
465 stack(BloombergLP::bslmf::MovableRef<stack> original);
471 stack(
const CONTAINER& container);
479 stack(BloombergLP::bslmf::MovableRef<CONTAINER> container);
484 template <
class ALLOCATOR>
486 stack(
const ALLOCATOR& basicAllocator,
488 ALLOCATOR>::type * = 0);
494 template <
class ALLOCATOR>
495 stack(
const CONTAINER& container,
496 const ALLOCATOR& basicAllocator,
498 ALLOCATOR>::type * = 0);
504 template <
class ALLOCATOR>
506 const ALLOCATOR& basicAllocator,
508 ALLOCATOR>::type * = 0);
519 template <
class ALLOCATOR>
520 stack(BloombergLP::bslmf::MovableRef<CONTAINER> container,
521 const ALLOCATOR& basicAllocator,
523 ALLOCATOR>::type * = 0);
534 template <
class ALLOCATOR>
535 stack(BloombergLP::bslmf::MovableRef<stack> original,
536 const ALLOCATOR& basicAllocator,
538 ALLOCATOR>::type * = 0);
555#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
561 template <
class... Args>
577 void push(BloombergLP::bslmf::MovableRef<value_type> value);
582 bsl::is_nothrow_swappable<CONTAINER>::value);
603#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
610template<
class CONTAINER,
611 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<CONTAINER>>
622 class = bsl::enable_if_t<bsl::uses_allocator_v<CONTAINER, ALLOCATOR>>
636template <
class VALUE,
class CONTAINER>
648template <
class VALUE,
class CONTAINER>
663template <
class VALUE,
class CONTAINER>
674template <
class VALUE,
class CONTAINER>
685template <
class VALUE,
class CONTAINER>
696template <
class VALUE,
class CONTAINER>
704template <
class VALUE,
class CONTAINER>
718template <
class VALUE,
class CONTAINER>
725template <
class VALUE,
class CONTAINER>
732template <
class VALUE,
class CONTAINER>
735: c(MoveUtil::move(MoveUtil::access(original).c))
739template <
class VALUE,
class CONTAINER>
740template <
class ALLOCATOR>
749template <
class VALUE,
class CONTAINER>
750template <
class ALLOCATOR>
753 const CONTAINER& container,
754 const ALLOCATOR& basicAllocator,
757: c(container, basicAllocator)
761template <
class VALUE,
class CONTAINER>
768template <
class VALUE,
class CONTAINER>
769template <
class ALLOCATOR>
772 const stack& original,
773 const ALLOCATOR& basicAllocator,
776: c(original.c, basicAllocator)
780template <
class VALUE,
class CONTAINER>
784: c(MoveUtil::move(container))
788template <
class VALUE,
class CONTAINER>
789template <
class ALLOCATOR>
792 BloombergLP::bslmf::MovableRef<CONTAINER> container,
793 const ALLOCATOR& basicAllocator,
796: c(MoveUtil::move(container), basicAllocator)
800template <
class VALUE,
class CONTAINER>
801template <
class ALLOCATOR>
804 BloombergLP::bslmf::MovableRef<stack> original,
805 const ALLOCATOR& basicAllocator,
808: c(MoveUtil::move(MoveUtil::access(original).c), basicAllocator)
813template <
class VALUE,
class CONTAINER>
822template <
class VALUE,
class CONTAINER>
825 BloombergLP::bslmf::MovableRef<stack> rhs)
828 c = MoveUtil::move(MoveUtil::access(rhs).c);
832#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
833template <
class VALUE,
class CONTAINER>
834template <
class... Args>
844template <
class VALUE,
class CONTAINER>
853template <
class VALUE,
class CONTAINER>
860template <
class VALUE,
class CONTAINER>
865 c.push_back(MoveUtil::move(value));
868template <
class VALUE,
class CONTAINER>
872 bsl::is_nothrow_swappable<CONTAINER>::value)
874 BloombergLP::bslalg::SwapUtil::swap(&c, &other.c);
877template <
class VALUE,
class CONTAINER>
887template <
class VALUE,
class CONTAINER>
891 return 0 == c.size();
894template <
class VALUE,
class CONTAINER>
901template <
class VALUE,
class CONTAINER>
909template <
class VALUE,
class CONTAINER>
914 return lhs.
c == rhs.
c;
917template <
class VALUE,
class CONTAINER>
922 return lhs.
c != rhs.
c;
925template <
class VALUE,
class CONTAINER>
930 return lhs.
c < rhs.
c;
933template <
class VALUE,
class CONTAINER>
938 return lhs.
c > rhs.
c;
941template <
class VALUE,
class CONTAINER>
946 return lhs.
c <= rhs.
c;
949template <
class VALUE,
class CONTAINER>
954 return lhs.
c >= rhs.
c;
957#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
958 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
959template <
class VALUE, three_way_comparable CONTAINER>
960inline compare_three_way_result_t<CONTAINER>
961operator<=>(
const stack<VALUE, CONTAINER>& lhs,
962 const stack<VALUE, CONTAINER>& rhs)
964 return lhs.c <=> rhs.c;
969template <
class VALUE,
class CONTAINER>
Definition bslstl_stack.h:394
CONTAINER::reference reference
Definition bslstl_stack.h:411
const_reference top() const
CONTAINER::size_type size_type
Definition bslstl_stack.h:413
friend bool operator>(const stack< VAL, CONT > &, const stack< VAL, CONT > &)
stack()
Definition bslstl_stack.h:720
friend bool operator<(const stack< VAL, CONT > &, const stack< VAL, CONT > &)
CONTAINER container_type
Definition bslstl_stack.h:414
friend bool operator!=(const stack< VAL, CONT > &, const stack< VAL, CONT > &)
friend bool operator>=(const stack< VAL, CONT > &, const stack< VAL, CONT > &)
bool empty() const
Definition bslstl_stack.h:889
friend bool operator==(const stack< VAL, CONT > &, const stack< VAL, CONT > &)
void pop()
Definition bslstl_stack.h:846
void push(const value_type &value)
Push the specified value onto the top of this stack.
Definition bslstl_stack.h:855
void swap(stack &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl reference top()
Definition bslstl_stack.h:586
BSLMF_NESTED_TRAIT_DECLARATION_IF(stack, BloombergLP::bslma::UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator< container_type >::value)
stack & operator=(const stack &rhs)
Definition bslstl_stack.h:815
friend bool operator<=(const stack< VAL, CONT > &, const stack< VAL, CONT > &)
size_type size() const
Return the number of elements contained in this stack.
Definition bslstl_stack.h:896
CONTAINER::value_type value_type
Definition bslstl_stack.h:410
CONTAINER::const_reference const_reference
Definition bslstl_stack.h:412
container_type c
Definition bslstl_stack.h:419
reference emplace(Args &&... args)
Definition bslstl_stack.h:837
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:634
Definition bdlb_printmethods.h:283
BSLS_KEYWORD_CONSTEXPR bool empty(const CONTAINER &container)
Definition bslstl_iterator.h:1279
Definition bslmf_enableif.h:525
Definition bslmf_issame.h:146
Definition bslmf_usesallocator.h:165