11#ifndef INCLUDED_BSLSTL_STACK_CPP03
12#define INCLUDED_BSLSTL_STACK_CPP03
63#ifdef COMPILING_BSLSTL_STACK_H
83template <
class VALUE,
class CONTAINER = deque<VALUE> >
86#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
96 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
100 typedef typename CONTAINER::value_type
value_type;
101 typedef typename CONTAINER::reference
reference;
103 typedef typename CONTAINER::size_type
size_type;
114 template <
class VAL,
class CONT>
115 friend bool operator==(
const stack<VAL, CONT>&,
const stack<VAL, CONT>&);
116 template <
class VAL,
class CONT>
117 friend bool operator!=(
const stack<VAL, CONT>&,
const stack<VAL, CONT>&);
118 template <
class VAL,
class CONT>
119 friend bool operator< (
const stack<VAL, CONT>&,
const stack<VAL, CONT>&);
120 template <
class VAL,
class CONT>
121 friend bool operator> (
const stack<VAL, CONT>&,
const stack<VAL, CONT>&);
122 template <
class VAL,
class CONT>
123 friend bool operator<=(
const stack<VAL, CONT>&,
const stack<VAL, CONT>&);
124 template <
class VAL,
class CONT>
125 friend bool operator>=(
const stack<VAL, CONT>&,
const stack<VAL, CONT>&);
126#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
127 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
128 template <
class VAL, three_way_comparable CONT>
129 friend compare_three_way_result_t<CONT>
130 operator<=>(
const stack<VAL, CONT>&,
const stack<VAL, CONT>&);
137 BloombergLP::bslma::UsesBslmaAllocator,
138 BloombergLP::bslma::UsesBslmaAllocator<container_type>::value);
155 stack(BloombergLP::bslmf::MovableRef<stack> original);
161 stack(
const CONTAINER& container);
169 stack(BloombergLP::bslmf::MovableRef<CONTAINER> container);
174 template <
class ALLOCATOR>
176 stack(
const ALLOCATOR& basicAllocator,
178 ALLOCATOR>::type * = 0);
184 template <
class ALLOCATOR>
185 stack(
const CONTAINER& container,
186 const ALLOCATOR& basicAllocator,
188 ALLOCATOR>::type * = 0);
194 template <
class ALLOCATOR>
196 const ALLOCATOR& basicAllocator,
198 ALLOCATOR>::type * = 0);
209 template <
class ALLOCATOR>
210 stack(BloombergLP::bslmf::MovableRef<CONTAINER> container,
211 const ALLOCATOR& basicAllocator,
213 ALLOCATOR>::type * = 0);
224 template <
class ALLOCATOR>
225 stack(BloombergLP::bslmf::MovableRef<stack> original,
226 const ALLOCATOR& basicAllocator,
228 ALLOCATOR>::type * = 0);
245#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
248#ifndef BSLSTL_STACK_VARIADIC_LIMIT
249#define BSLSTL_STACK_VARIADIC_LIMIT 10
251#ifndef BSLSTL_STACK_VARIADIC_LIMIT_A
252#define BSLSTL_STACK_VARIADIC_LIMIT_A BSLSTL_STACK_VARIADIC_LIMIT
254#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 0
258#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 1
259 template <
class Args_01>
263#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 2
264 template <
class Args_01,
270#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 3
271 template <
class Args_01,
279#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 4
280 template <
class Args_01,
290#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 5
291 template <
class Args_01,
303#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 6
304 template <
class Args_01,
318#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 7
319 template <
class Args_01,
335#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 8
336 template <
class Args_01,
354#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 9
355 template <
class Args_01,
375#if BSLSTL_STACK_VARIADIC_LIMIT_A >= 10
376 template <
class Args_01,
401 template <
class... Args>
418 void push(BloombergLP::bslmf::MovableRef<value_type> value);
423 bsl::is_nothrow_swappable<CONTAINER>::value);
444#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
451template<
class CONTAINER,
452 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<CONTAINER>>
454stack(CONTAINER) -> stack<typename CONTAINER::value_type, CONTAINER>;
463 class = bsl::enable_if_t<bsl::uses_allocator_v<CONTAINER, ALLOCATOR>>
465stack(CONTAINER, ALLOCATOR) -> stack<typename CONTAINER::value_type, CONTAINER>;
477template <
class VALUE,
class CONTAINER>
478bool operator==(
const stack<VALUE, CONTAINER>& lhs,
479 const stack<VALUE, CONTAINER>& rhs);
489template <
class VALUE,
class CONTAINER>
490bool operator!=(
const stack<VALUE, CONTAINER>& lhs,
491 const stack<VALUE, CONTAINER>& rhs);
504template <
class VALUE,
class CONTAINER>
505bool operator< (
const stack<VALUE, CONTAINER>& lhs,
506 const stack<VALUE, CONTAINER>& rhs);
515template <
class VALUE,
class CONTAINER>
516bool operator> (
const stack<VALUE, CONTAINER>& lhs,
517 const stack<VALUE, CONTAINER>& rhs);
526template <
class VALUE,
class CONTAINER>
527bool operator<=(
const stack<VALUE, CONTAINER>& lhs,
528 const stack<VALUE, CONTAINER>& rhs);
537template <
class VALUE,
class CONTAINER>
538bool operator>=(
const stack<VALUE, CONTAINER>& lhs,
539 const stack<VALUE, CONTAINER>& rhs);
545template <
class VALUE,
class CONTAINER>
546void swap(stack<VALUE, CONTAINER>& lhs,
547 stack<VALUE, CONTAINER>& rhs)
559template <
class VALUE,
class CONTAINER>
566template <
class VALUE,
class CONTAINER>
568stack<VALUE, CONTAINER>::stack(
const CONTAINER& container)
573template <
class VALUE,
class CONTAINER>
575stack<VALUE, CONTAINER>::stack(BloombergLP::bslmf::MovableRef<stack> original)
576: c(MoveUtil::move(MoveUtil::access(original).c))
580template <
class VALUE,
class CONTAINER>
581template <
class ALLOCATOR>
583stack<VALUE, CONTAINER>::stack(
const ALLOCATOR& basicAllocator,
590template <
class VALUE,
class CONTAINER>
591template <
class ALLOCATOR>
593stack<VALUE, CONTAINER>::stack(
594 const CONTAINER& container,
595 const ALLOCATOR& basicAllocator,
598: c(container, basicAllocator)
602template <
class VALUE,
class CONTAINER>
604stack<VALUE, CONTAINER>::stack(
const stack& original)
609template <
class VALUE,
class CONTAINER>
610template <
class ALLOCATOR>
612stack<VALUE, CONTAINER>::stack(
613 const stack& original,
614 const ALLOCATOR& basicAllocator,
617: c(original.c, basicAllocator)
621template <
class VALUE,
class CONTAINER>
623stack<VALUE, CONTAINER>::stack(BloombergLP::bslmf::MovableRef<CONTAINER>
625: c(MoveUtil::move(container))
629template <
class VALUE,
class CONTAINER>
630template <
class ALLOCATOR>
632stack<VALUE, CONTAINER>::stack(
633 BloombergLP::bslmf::MovableRef<CONTAINER> container,
634 const ALLOCATOR& basicAllocator,
637: c(MoveUtil::move(container), basicAllocator)
641template <
class VALUE,
class CONTAINER>
642template <
class ALLOCATOR>
644stack<VALUE, CONTAINER>::stack(
645 BloombergLP::bslmf::MovableRef<stack> original,
646 const ALLOCATOR& basicAllocator,
649: c(MoveUtil::move(MoveUtil::access(original).c), basicAllocator)
654template <
class VALUE,
class CONTAINER>
656stack<VALUE, CONTAINER>& stack<VALUE, CONTAINER>::operator=(
const stack& rhs)
663template <
class VALUE,
class CONTAINER>
665stack<VALUE, CONTAINER>& stack<VALUE, CONTAINER>::operator=(
666 BloombergLP::bslmf::MovableRef<stack> rhs)
669 c = MoveUtil::move(MoveUtil::access(rhs).c);
673#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
676#ifndef BSLSTL_STACK_VARIADIC_LIMIT
677#define BSLSTL_STACK_VARIADIC_LIMIT 10
679#ifndef BSLSTL_STACK_VARIADIC_LIMIT_B
680#define BSLSTL_STACK_VARIADIC_LIMIT_B BSLSTL_STACK_VARIADIC_LIMIT
682#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 0
683template <
class VALUE,
class CONTAINER>
685typename stack<VALUE, CONTAINER>::reference
686stack<VALUE, CONTAINER>::emplace(
694#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 1
695template <
class VALUE,
class CONTAINER>
696template <
class Args_01>
698typename stack<VALUE, CONTAINER>::reference
699stack<VALUE, CONTAINER>::emplace(
707#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 2
708template <
class VALUE,
class CONTAINER>
709template <
class Args_01,
712typename stack<VALUE, CONTAINER>::reference
713stack<VALUE, CONTAINER>::emplace(
723#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 3
724template <
class VALUE,
class CONTAINER>
725template <
class Args_01,
729typename stack<VALUE, CONTAINER>::reference
730stack<VALUE, CONTAINER>::emplace(
742#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 4
743template <
class VALUE,
class CONTAINER>
744template <
class Args_01,
749typename stack<VALUE, CONTAINER>::reference
750stack<VALUE, CONTAINER>::emplace(
764#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 5
765template <
class VALUE,
class CONTAINER>
766template <
class Args_01,
772typename stack<VALUE, CONTAINER>::reference
773stack<VALUE, CONTAINER>::emplace(
789#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 6
790template <
class VALUE,
class CONTAINER>
791template <
class Args_01,
798typename stack<VALUE, CONTAINER>::reference
799stack<VALUE, CONTAINER>::emplace(
817#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 7
818template <
class VALUE,
class CONTAINER>
819template <
class Args_01,
827typename stack<VALUE, CONTAINER>::reference
828stack<VALUE, CONTAINER>::emplace(
848#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 8
849template <
class VALUE,
class CONTAINER>
850template <
class Args_01,
859typename stack<VALUE, CONTAINER>::reference
860stack<VALUE, CONTAINER>::emplace(
882#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 9
883template <
class VALUE,
class CONTAINER>
884template <
class Args_01,
894typename stack<VALUE, CONTAINER>::reference
895stack<VALUE, CONTAINER>::emplace(
919#if BSLSTL_STACK_VARIADIC_LIMIT_B >= 10
920template <
class VALUE,
class CONTAINER>
921template <
class Args_01,
932typename stack<VALUE, CONTAINER>::reference
933stack<VALUE, CONTAINER>::emplace(
962template <
class VALUE,
class CONTAINER>
963template <
class... Args>
965typename stack<VALUE, CONTAINER>::reference
966stack<VALUE, CONTAINER>::emplace(
975template <
class VALUE,
class CONTAINER>
977void stack<VALUE, CONTAINER>::pop()
984template <
class VALUE,
class CONTAINER>
986void stack<VALUE, CONTAINER>::push(
const value_type& value)
991template <
class VALUE,
class CONTAINER>
993void stack<VALUE, CONTAINER>::push(BloombergLP::bslmf::MovableRef<value_type>
996 c.push_back(MoveUtil::move(value));
999template <
class VALUE,
class CONTAINER>
1001void stack<VALUE, CONTAINER>::swap(stack& other)
1003 bsl::is_nothrow_swappable<CONTAINER>::value)
1005 BloombergLP::bslalg::SwapUtil::swap(&c, &other.c);
1008template <
class VALUE,
class CONTAINER>
1010typename CONTAINER::reference stack<VALUE, CONTAINER>::top()
1018template <
class VALUE,
class CONTAINER>
1020bool stack<VALUE, CONTAINER>::empty()
const
1022 return 0 == c.size();
1025template <
class VALUE,
class CONTAINER>
1027typename CONTAINER::size_type stack<VALUE, CONTAINER>::size()
const
1032template <
class VALUE,
class CONTAINER>
1034typename CONTAINER::const_reference stack<VALUE, CONTAINER>::top()
const
1040template <
class VALUE,
class CONTAINER>
1042bool operator==(
const stack<VALUE, CONTAINER>& lhs,
1043 const stack<VALUE, CONTAINER>& rhs)
1045 return lhs.c == rhs.c;
1048template <
class VALUE,
class CONTAINER>
1050bool operator!=(
const stack<VALUE, CONTAINER>& lhs,
1051 const stack<VALUE, CONTAINER>& rhs)
1053 return lhs.c != rhs.c;
1056template <
class VALUE,
class CONTAINER>
1058bool operator< (
const stack<VALUE, CONTAINER>& lhs,
1059 const stack<VALUE, CONTAINER>& rhs)
1061 return lhs.c < rhs.c;
1064template <
class VALUE,
class CONTAINER>
1066bool operator> (
const stack<VALUE, CONTAINER>& lhs,
1067 const stack<VALUE, CONTAINER>& rhs)
1069 return lhs.c > rhs.c;
1072template <
class VALUE,
class CONTAINER>
1074bool operator<=(
const stack<VALUE, CONTAINER>& lhs,
1075 const stack<VALUE, CONTAINER>& rhs)
1077 return lhs.c <= rhs.c;
1080template <
class VALUE,
class CONTAINER>
1082bool operator>=(
const stack<VALUE, CONTAINER>& lhs,
1083 const stack<VALUE, CONTAINER>& rhs)
1085 return lhs.c >= rhs.c;
1088#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
1089 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1090template <
class VALUE, three_way_comparable CONTAINER>
1091inline compare_three_way_result_t<CONTAINER>
1092operator<=>(
const stack<VALUE, CONTAINER>& lhs,
1093 const stack<VALUE, CONTAINER>& rhs)
1095 return lhs.c <=> rhs.c;
1100template <
class VALUE,
class CONTAINER>
1102void swap(stack<VALUE, CONTAINER>& lhs,
1103 stack<VALUE, CONTAINER>& rhs)
1112# error Not valid except when included from bslstl_stack.h
#define BSLMF_NESTED_TRAIT_DECLARATION_IF(t_TYPE, t_TRAIT, t_COND)
Definition bslmf_nestedtraitdeclaration.h:243
CONTAINER::reference reference
Definition bslstl_stack.h:411
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
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
static const t_TYPE value
Definition bslmf_integralconstant.h:258
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:634
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
bool operator>=(const Guid &lhs, const Guid &rhs)
bool operator<=(const Guid &lhs, const Guid &rhs)
Definition bdlb_printmethods.h:283
BSLS_KEYWORD_CONSTEXPR bool empty(const CONTAINER &container)
Definition bslstl_iterator.h:1279
Definition bslmf_usesallocator.h:165