11#ifndef INCLUDED_BSLSTL_OPTIONAL_CPP03
12#define INCLUDED_BSLSTL_OPTIONAL_CPP03
63#ifdef COMPILING_BSLSTL_OPTIONAL_H
69#if defined (BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY) && \
70 !(defined(BSLS_LIBRARYFEATURES_FORCE_ABI_ENABLED) && \
71 (BSLS_LIBRARYFEATURES_FORCE_ABI_ENABLED < 17))
85# define BSLSTL_OPTIONAL_USES_STD_ALIASES
90# define BSLSTL_OPTIONAL_CONSTEXPR17 constexpr
95# ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_BASELINE_LIBRARY
96# define BSLSTL_OPTIONAL_CONSTEXPR20 BSLS_KEYWORD_CONSTEXPR_CPP20
98# define BSLSTL_OPTIONAL_CONSTEXPR20
101# define BSLSTL_OPTIONAL_CONSTEXPR17
102# define BSLSTL_OPTIONAL_CONSTEXPR20
105# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
112#define BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(U, V, DEFAULT) \
113 std::is_constructible<U, V>::value
118#define BSLSTL_OPTIONAL_IS_ASSIGNABLE(U, V, DEFAULT) \
119 std::is_assignable<U, V>::value
123#define BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(U, V, DEFAULT) DEFAULT
125#define BSLSTL_OPTIONAL_IS_ASSIGNABLE(U, V, DEFAULT) DEFAULT
132#define BSLSTL_OPTIONAL_CONVERTS_FROM(TYPE, OPT_TYPE) \
133 (bsl::is_convertible<const OPT_TYPE&, TYPE>::value || \
134 bsl::is_convertible<OPT_TYPE&, TYPE>::value || \
135 bsl::is_convertible<const OPT_TYPE, TYPE>::value || \
136 bsl::is_convertible<OPT_TYPE, TYPE>::value || \
137 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, const OPT_TYPE&, false) || \
138 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, OPT_TYPE&, false) || \
139 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, const OPT_TYPE, false) || \
140 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, OPT_TYPE, false))
145# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
146#define BSLSTL_OPTIONAL_ASSIGNS_FROM(TYPE, OPT_TYPE) \
147 (std::is_assignable<TYPE&, const OPT_TYPE&>::value || \
148 std::is_assignable<TYPE&, OPT_TYPE&>::value || \
149 std::is_assignable<TYPE&, const OPT_TYPE>::value || \
150 std::is_assignable<TYPE&, OPT_TYPE>::value)
155#define BSLSTL_OPTIONAL_ASSIGNS_FROM(TYPE, OPT_TYPE) false
158#define BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) \
159 BSLSTL_OPTIONAL_CONVERTS_FROM( \
161 bsl::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
163#define BSLSTL_OPTIONAL_ASSIGNS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) \
164 BSLSTL_OPTIONAL_ASSIGNS_FROM( \
166 bsl::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
168# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
169#define BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) \
170 BSLSTL_OPTIONAL_CONVERTS_FROM( \
172 std::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
174#define BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) \
175 BSLSTL_OPTIONAL_ASSIGNS_FROM( \
177 std::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
181#define BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) false
182#define BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) false
188#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE, \
190 typename bsl::enable_if< \
191 !bsl::is_same<TYPE, ANY_TYPE>::value && \
192 !BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) && \
193 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true), \
194 BloombergLP::bslstl::Optional_OptNoSuchType>::type
196#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE, \
198 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL( \
200 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
202#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE, \
204 typename bsl::enable_if< \
205 !BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) && \
206 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true), \
207 BloombergLP::bslstl::Optional_OptNoSuchType>::type
209#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE, \
211 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL( \
213 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
215#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE, \
217 typename bsl::enable_if< \
218 BloombergLP::bslstl::Optional_PropagatesAllocator<TYPE, \
220 BloombergLP::bslstl::Optional_OptNoSuchType>::type
222#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE, \
224 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR( \
226 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
228#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( \
230 typename bsl::enable_if< \
231 !BloombergLP::bslstl::Optional_PropagatesAllocator<TYPE, \
233 BloombergLP::bslstl::Optional_OptNoSuchType>::type
235#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( \
237 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( \
239 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
241#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE) \
242 typename bsl::enable_if< \
243 BloombergLP::bslstl::Optional_ConstructsFromType<TYPE, \
245 BloombergLP::bslstl::Optional_OptNoSuchType>::type
247#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE) \
248 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM( \
250 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
252#define BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(DERIVED) \
253 typename bsl::enable_if< \
254 BloombergLP::bslmf::IsAccessibleBaseOf<optional, DERIVED>::value && \
255 !bsl::is_const<DERIVED>::value, \
256 BloombergLP::bslstl::Optional_OptNoSuchType>::type
258#define BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(DERIVED) \
259 BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(DERIVED) = \
260 BloombergLP::bslstl::Optional_OptNoSuchType(0)
262#define BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(U, V) \
263 typename bsl::enable_if< \
264 !bsl::is_convertible<V, U>::value, \
265 BloombergLP::bslstl::Optional_OptNoSuchType>::type
267#define BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(U, V) \
268 BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT( \
270 V) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
272#define BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(U, V) \
273 typename bsl::enable_if< \
274 bsl::is_convertible<V, U>::value, \
275 BloombergLP::bslstl::Optional_OptNoSuchType>::type
277#define BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(U, V) \
278 BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT( \
280 V) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
282#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) \
283 typename bsl::enable_if< \
284 !BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) && \
285 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true) && \
286 BSLSTL_OPTIONAL_IS_ASSIGNABLE(TYPE&, ANY_TYPE, true) && \
287 !BSLSTL_OPTIONAL_ASSIGNS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE), \
288 optional<TYPE> >::type
290#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) \
291 typename bsl::enable_if< \
292 !BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) && \
293 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true) && \
294 BSLSTL_OPTIONAL_IS_ASSIGNABLE(TYPE&, ANY_TYPE, true) && \
295 !BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE), \
296 optional<TYPE> >::type
298# if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
299# define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED(TYPE, DERIVED) \
300 typename bsl::enable_if< \
301 BloombergLP::bslmf::IsAccessibleBaseOf<bsl::optional<TYPE>, \
303 !bsl::is_same<bsl::optional<TYPE>, DERIVED>::value, \
304 optional<TYPE> >::type
307#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_FORWARD_REF(TYPE, ANY_TYPE) \
308 typename bsl::enable_if< \
309 !bsl::is_same<bsl::optional<TYPE>, \
310 typename bsl::remove_cvref<ANY_TYPE>::type>::value && \
311 !(bsl::is_same<TYPE, \
312 typename bsl::decay<ANY_TYPE>::type>::value && \
313 std::is_scalar<TYPE>::value) && \
314 std::is_constructible<TYPE, ANY_TYPE>::value && \
315 std::is_assignable<TYPE, ANY_TYPE>::value, \
316 optional<TYPE> >::type
318#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(TYPE, ANY_TYPE) \
319 typename bsl::enable_if< \
320 !::BloombergLP::bslmf::IsAccessibleBaseOf< \
321 bsl::optional<TYPE>, \
322 typename bsl::remove_cv< \
323 typename ::BloombergLP::bslmf::MovableRefUtil:: \
324 RemoveReference<ANY_TYPE>::type>::type>::value, \
325 optional<TYPE> >::type
327#define BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(ARG) \
328 typename bsl::enable_if< \
330 typename bsl::remove_cvref<ARG>::type, \
331 bsl::allocator_arg_t>::value, \
332 optional<t_TYPE> >::type
334#ifdef BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS
335 #define BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(ARG) = ARG
337 #define BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(ARG)
340#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
341 #define BSLSTL_OPTIONAL_REQUIRES(EXPR) requires(EXPR)
343 #define BSLSTL_OPTIONAL_REQUIRES(EXPR)
352struct Optional_NulloptConstructToken {
359# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
361using nullopt_t = std::nullopt_t;
381 template <
class t_TYPE>
384 typename enable_if<is_same<t_TYPE,
385 BloombergLP::bslstl::
386 Optional_NulloptConstructToken>::value,
394# if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES)
396nullopt_t
nullopt(BloombergLP::bslstl::Optional_NulloptConstructToken{});
403template <
class t_TYPE>
419template <
class t_TYPE>
423template <
class t_TYPE>
431# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
437template <
class t_TYPE>
438struct Optional_IsTriviallyDestructible
439: std::is_trivially_destructible<t_TYPE> {
453template <
class t_TYPE>
472struct Optional_OptNoSuchType {
500template <
class t_TYPE,
class t_ANY_TYPE>
501struct Optional_PropagatesAllocator
504 bslma::UsesBslmaAllocator<t_TYPE>::value &&
505 bsl::is_const<t_TYPE>::value &&
506 bsl::is_same<t_ANY_TYPE,
507 typename bsl::remove_cv<t_TYPE>::type>::value> {
513template <
class t_TYPE,
class t_ANY_TYPE>
514struct Optional_ConstructsFromType
517 !bslmf::IsAccessibleBaseOf<
518 bsl::optional<t_TYPE>,
519 typename bsl::remove_cvref<t_ANY_TYPE>::type>::value &&
520 !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
521 bsl::nullopt_t>::value &&
522 !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
523 bsl::in_place_t>::value &&
524 !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
525 bsl::allocator_arg_t>::value &&
526 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(t_TYPE, t_ANY_TYPE, true)> {
529#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
539template <
class t_TYPE,
class t_INVOCABLE,
class t_ARG>
540struct Optional_ImmovableHelper {
541 t_INVOCABLE&& invocable;
546 return std::invoke(std::forward<t_INVOCABLE>(invocable),
547 std::forward<t_ARG>(arg));
560struct Optional_ConstructFromForwardRef {};
561struct Optional_CopyConstructFromOtherOptional {};
562struct Optional_MoveConstructFromOtherOptional {};
563struct Optional_CopyConstructFromStdOptional {};
564struct Optional_MoveConstructFromStdOptional {};
566#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
570struct Optional_InvokeConstructorTag {
571 explicit Optional_InvokeConstructorTag() =
default;
590template <
class t_TYPE>
591struct Optional_DataImp {
611#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
614 template <
class t_INVOCABLE,
class t_ARG>
616 t_INVOCABLE&& invocable,
621#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
624#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
625#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
627#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_A
628#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_A BSLSTL_OPTIONAL_VARIADIC_LIMIT
630#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0
634#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1
635 template <
class t_ARGS_01>
640#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2
641 template <
class t_ARGS_01,
648#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3
649 template <
class t_ARGS_01,
658#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4
659 template <
class t_ARGS_01,
670#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5
671 template <
class t_ARGS_01,
684#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6
685 template <
class t_ARGS_01,
700#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7
701 template <
class t_ARGS_01,
718#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8
719 template <
class t_ARGS_01,
738#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9
739 template <
class t_ARGS_01,
760#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10
761 template <
class t_ARGS_01,
785# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
786#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0
787 template <
class t_INIT_LIST_TYPE>
790 std::initializer_list<t_INIT_LIST_TYPE> initializer_list);
793#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1
794 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
797 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
801#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2
802 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
806 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
811#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3
812 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
817 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
823#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4
824 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
830 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
837#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5
838 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
845 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
853#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6
854 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
862 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
871#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7
872 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
881 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
891#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8
892 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
902 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
913#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9
914 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
925 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
937#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10
938 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
950 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
967 template <
class... t_ARGS>
971# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
972 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
975 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
984# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
1004# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
1009 const t_TYPE&
value() const &;
1010 const t_TYPE&&
value() const &&;
1017 const t_TYPE&
value()
const;
1033 bool t_IS_TRIVIALLY_DESTRUCTIBLE =
1035struct Optional_Data :
public Optional_DataImp<t_TYPE> {
1039#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
1054template <
class t_TYPE>
1055struct Optional_Data<t_TYPE, true> :
public Optional_DataImp<t_TYPE> {
1062#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
1072#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1073template <
class t_TYPE>
1076template <
class t_TYPE>
1077void optional_acceptsStdOptional(
const std::optional<t_TYPE>&);
1081template <
class t_TYPE>
1082concept Optional_ConvertibleToBool =
1083 bsl::is_convertible_v<t_TYPE, bool>;
1087template <
class t_TYPE>
1088concept Optional_DerivedFromBslOptional =
1089 requires (
const t_TYPE& t) { optional_acceptsBslOptional(t); };
1093template <
class t_TYPE>
1094concept Optional_DerivedFromStdOptional =
1095 requires (
const t_TYPE& t) { optional_acceptsStdOptional(t); };
1099template <
class t_TYPE>
1100concept Optional_DerivedFromOptional =
1101 Optional_DerivedFromBslOptional<t_TYPE> ||
1102 Optional_DerivedFromStdOptional<t_TYPE>;
1119template <
class t_TYPE,
1120 bool t_USES_BSLMA_ALLOC =
1121 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>
1122class Optional_Base {
1141 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
1143# ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
1150 typedef BloombergLP::bsls::UnspecifiedBool<Optional_Base>
1151 UnspecifiedBoolUtil;
1152 typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
1158 BloombergLP::bslstl::Optional_Data<t_TYPE> d_value;
1184 Optional_Base(BloombergLP::bslmf::MovableRef<Optional_Base> original)
1191 template <
class t_ANY_TYPE>
1192 Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
1199 template <
class t_ANY_TYPE>
1200 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
1201 const Optional_Base<t_ANY_TYPE>& original);
1208 template <
class t_ANY_TYPE>
1210 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
1222 template <
class t_ANY_TYPE>
1224 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
1229# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
1234 template <
class t_ANY_TYPE>
1235 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
1236 const std::optional<t_ANY_TYPE>& original);
1242 template <
class t_ANY_TYPE>
1243 Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
1244 std::optional<t_ANY_TYPE>&& original);
1247#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1250#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
1251#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
1253#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_B
1254#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_B BSLSTL_OPTIONAL_VARIADIC_LIMIT
1256#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0
1260#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1
1261 template <
class t_ARGS_01>
1266#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2
1267 template <
class t_ARGS_01,
1274#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3
1275 template <
class t_ARGS_01,
1284#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4
1285 template <
class t_ARGS_01,
1296#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5
1297 template <
class t_ARGS_01,
1310#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6
1311 template <
class t_ARGS_01,
1326#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7
1327 template <
class t_ARGS_01,
1344#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8
1345 template <
class t_ARGS_01,
1364#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9
1365 template <
class t_ARGS_01,
1386#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10
1387 template <
class t_ARGS_01,
1410# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1411#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0
1412 template <
class t_INIT_LIST_TYPE>
1414 std::initializer_list<t_INIT_LIST_TYPE> il);
1417#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1
1418 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
1420 std::initializer_list<t_INIT_LIST_TYPE> il,
1424#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2
1425 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1428 std::initializer_list<t_INIT_LIST_TYPE> il,
1433#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3
1434 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1438 std::initializer_list<t_INIT_LIST_TYPE> il,
1444#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4
1445 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1450 std::initializer_list<t_INIT_LIST_TYPE> il,
1457#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5
1458 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1464 std::initializer_list<t_INIT_LIST_TYPE> il,
1472#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6
1473 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1480 std::initializer_list<t_INIT_LIST_TYPE> il,
1489#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7
1490 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1498 std::initializer_list<t_INIT_LIST_TYPE> il,
1508#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8
1509 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1518 std::initializer_list<t_INIT_LIST_TYPE> il,
1529#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9
1530 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1540 std::initializer_list<t_INIT_LIST_TYPE> il,
1552#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10
1553 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1564 std::initializer_list<t_INIT_LIST_TYPE> il,
1581 template <
class... t_ARGS>
1584# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1585 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
1587 std::initializer_list<t_INIT_LIST_TYPE> il,
1593#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
1596 template <
class t_INVOCABLE,
class t_ARG>
1598 t_INVOCABLE&& invocable,
1629 BloombergLP::bslmf::MovableRef<Optional_Base> original);
1634 template <
class t_ANY_TYPE>
1637 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
1644 template <
class t_ANY_TYPE>
1647 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
1648 const Optional_Base<t_ANY_TYPE>& original);
1656 template <
class t_ANY_TYPE>
1659 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
1662# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
1668 template <
class t_ANY_TYPE>
1671 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
1672 const std::optional<t_ANY_TYPE>& original);
1680 template <
class t_ANY_TYPE>
1683 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
1684 std::optional<t_ANY_TYPE>&& original);
1687#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1690#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
1691#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
1693#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_C
1694#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_C BSLSTL_OPTIONAL_VARIADIC_LIMIT
1696#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0
1702#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1
1703 template <
class t_ARGS_01>
1710#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2
1711 template <
class t_ARGS_01,
1720#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3
1721 template <
class t_ARGS_01,
1732#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4
1733 template <
class t_ARGS_01,
1746#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5
1747 template <
class t_ARGS_01,
1762#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6
1763 template <
class t_ARGS_01,
1780#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7
1781 template <
class t_ARGS_01,
1800#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8
1801 template <
class t_ARGS_01,
1822#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9
1823 template <
class t_ARGS_01,
1846#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10
1847 template <
class t_ARGS_01,
1873# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1874#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0
1875 template <
class t_INIT_LIST_TYPE>
1879 std::initializer_list<t_INIT_LIST_TYPE> il);
1882#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1
1883 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
1887 std::initializer_list<t_INIT_LIST_TYPE> il,
1891#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2
1892 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1897 std::initializer_list<t_INIT_LIST_TYPE> il,
1902#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3
1903 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1909 std::initializer_list<t_INIT_LIST_TYPE> il,
1915#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4
1916 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1923 std::initializer_list<t_INIT_LIST_TYPE> il,
1930#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5
1931 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1939 std::initializer_list<t_INIT_LIST_TYPE> il,
1947#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6
1948 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1957 std::initializer_list<t_INIT_LIST_TYPE> il,
1966#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7
1967 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1977 std::initializer_list<t_INIT_LIST_TYPE> il,
1987#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8
1988 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
1999 std::initializer_list<t_INIT_LIST_TYPE> il,
2010#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9
2011 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2023 std::initializer_list<t_INIT_LIST_TYPE> il,
2035#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10
2036 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2049 std::initializer_list<t_INIT_LIST_TYPE> il,
2066 template <
class... t_ARGS>
2072# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2073 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
2077 std::initializer_list<t_INIT_LIST_TYPE> il,
2089 template <
class t_ANY_TYPE>
2092# ifndef BDE_OMIT_INTERNAL_DEPRECATED
2123 BloombergLP::bslma::UsesBslmaAllocator);
2125 BloombergLP::bslmf::UsesAllocatorArgT);
2128 BloombergLP::bslmf::IsBitwiseMoveable,
2129 BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
2132 BloombergLP::bslmf::IsBitwiseCopyable,
2133 BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
2137#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2140#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
2141#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
2143#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_D
2144#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_D BSLSTL_OPTIONAL_VARIADIC_LIMIT
2146#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0
2150#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1
2151 template <
class t_ARGS_01>
2155#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2
2156 template <
class t_ARGS_01,
2162#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3
2163 template <
class t_ARGS_01,
2171#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4
2172 template <
class t_ARGS_01,
2182#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5
2183 template <
class t_ARGS_01,
2195#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6
2196 template <
class t_ARGS_01,
2210#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7
2211 template <
class t_ARGS_01,
2227#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8
2228 template <
class t_ARGS_01,
2246#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9
2247 template <
class t_ARGS_01,
2267#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10
2268 template <
class t_ARGS_01,
2291# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2292#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0
2293 template <
class t_INIT_LIST_TYPE>
2294 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il);
2297#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1
2298 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
2299 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2303#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2
2304 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2306 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2311#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3
2312 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2315 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2321#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4
2322 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2326 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2333#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5
2334 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2339 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2347#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6
2348 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2354 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2363#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7
2364 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2371 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2381#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8
2382 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2390 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2401#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9
2402 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2411 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2423#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10
2424 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
2434 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2452 template <
class... t_ARGS>
2455# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2456 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
2457 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2475 bsl::is_nothrow_move_constructible<t_TYPE>::
value &&
2476 bsl::is_nothrow_swappable<t_TYPE>::
value);
2478# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2483 t_TYPE&&
value() &&;
2491# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2497 template <
class t_ANY_TYPE>
2499# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2506 template <
class t_ANY_TYPE>
2509 t_ANY_TYPE&&
value) &&;
2523 BloombergLP::bslmf::MovableRef<Optional_Base> rhs);
2531# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2554# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2558 const t_TYPE&
value() const &;
2559 const t_TYPE&&
value() const &&;
2564 const t_TYPE&
value()
const;
2573# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2579 const t_TYPE&& operator*() const &&;
2588# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2594 template <
class t_ANY_TYPE>
2597# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2604 template <
class t_ANY_TYPE>
2616 template <
class t_ANY_TYPE>
2618# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2625 template <
class t_ANY_TYPE>
2632#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
2640 return UnspecifiedBoolUtil::makeValue(
has_value());
2653# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
2656template <
class t_TYPE>
2657class Optional_Base<t_TYPE, false> :
public std::optional<t_TYPE> {
2661 typedef std::optional<t_TYPE> StdOptionalBase;
2683 template <
class t_ANY_TYPE>
2685 Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
2686 t_ANY_TYPE&&
value);
2691 template <
class t_ANY_TYPE>
2693 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
2694 const Optional_Base<t_ANY_TYPE>& original);
2700 template <
class t_ANY_TYPE>
2702 Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
2703 Optional_Base<t_ANY_TYPE>&& original);
2705 template <
class t_ANY_TYPE>
2707 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
2708 const std::optional<t_ANY_TYPE>& original);
2710 template <
class t_ANY_TYPE>
2712 Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
2713 std::optional<t_ANY_TYPE>&& original);
2717 template <
class... t_ARGS>
2722 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
2725 std::initializer_list<t_INIT_LIST_TYPE> il,
2728#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
2731 template <
class t_INVOCABLE,
class t_ARG>
2733 t_INVOCABLE&& invocable,
2744 template <
class t_ANY_TYPE>
2747 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
2750 template <
class t_ANY_TYPE>
2753 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
2754 const Optional_Base<t_ANY_TYPE>&);
2756 template <
class t_ANY_TYPE>
2759 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
2760 Optional_Base<t_ANY_TYPE>&&);
2762 template <
class t_ANY_TYPE>
2765 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
2766 const std::optional<t_ANY_TYPE>&);
2768 template <
class t_ANY_TYPE>
2771 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
2772 std::optional<t_ANY_TYPE>&&);
2774 template <
class... t_ARGS>
2780 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
2784 std::initializer_list<t_INIT_LIST_TYPE>,
2792 template <
class t_ANY_TYPE>
2795# ifndef BDE_OMIT_INTERNAL_DEPRECATED
2827 BloombergLP::bslmf::IsBitwiseMoveable,
2828 BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
2831 BloombergLP::bslmf::IsBitwiseCopyable,
2832 BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
2846template <
class t_TYPE>
2847class Optional_Base<t_TYPE, false> {
2851 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
2853# ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
2860 typedef BloombergLP::bsls::UnspecifiedBool<Optional_Base>
2861 UnspecifiedBoolUtil;
2862 typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
2868 BloombergLP::bslstl::Optional_Data<t_TYPE> d_value;
2896 Optional_Base(BloombergLP::bslmf::MovableRef<Optional_Base> original)
2902 template <
class t_ANY_TYPE>
2903 Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
2909 template <
class t_ANY_TYPE>
2910 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
2911 const Optional_Base<t_ANY_TYPE>& original);
2917 template <
class t_ANY_TYPE>
2918 Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
2921#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2924#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
2925#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
2927#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_E
2928#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_E BSLSTL_OPTIONAL_VARIADIC_LIMIT
2930#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0
2934#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1
2935 template <
class t_ARGS_01>
2940#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2
2941 template <
class t_ARGS_01,
2948#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3
2949 template <
class t_ARGS_01,
2958#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4
2959 template <
class t_ARGS_01,
2970#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5
2971 template <
class t_ARGS_01,
2984#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6
2985 template <
class t_ARGS_01,
3000#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7
3001 template <
class t_ARGS_01,
3018#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8
3019 template <
class t_ARGS_01,
3038#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9
3039 template <
class t_ARGS_01,
3060#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10
3061 template <
class t_ARGS_01,
3085# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3086#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0
3087 template <
class t_INIT_LIST_TYPE>
3089 std::initializer_list<t_INIT_LIST_TYPE> il);
3092#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1
3093 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
3095 std::initializer_list<t_INIT_LIST_TYPE> il,
3099#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2
3100 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3103 std::initializer_list<t_INIT_LIST_TYPE> il,
3108#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3
3109 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3113 std::initializer_list<t_INIT_LIST_TYPE> il,
3119#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4
3120 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3125 std::initializer_list<t_INIT_LIST_TYPE> il,
3132#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5
3133 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3139 std::initializer_list<t_INIT_LIST_TYPE> il,
3147#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6
3148 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3155 std::initializer_list<t_INIT_LIST_TYPE> il,
3164#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7
3165 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3173 std::initializer_list<t_INIT_LIST_TYPE> il,
3183#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8
3184 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3193 std::initializer_list<t_INIT_LIST_TYPE> il,
3204#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9
3205 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3215 std::initializer_list<t_INIT_LIST_TYPE> il,
3227#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10
3228 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3239 std::initializer_list<t_INIT_LIST_TYPE> il,
3256 template <
class... t_ARGS>
3260# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3261 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
3263 std::initializer_list<t_INIT_LIST_TYPE> il,
3280 BloombergLP::bslmf::MovableRef<Optional_Base>);
3282 template <
class t_ANY_TYPE>
3285 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
3288 template <
class t_ANY_TYPE>
3291 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
3292 const Optional_Base<t_ANY_TYPE>&);
3294 template <
class t_ANY_TYPE>
3297 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
3300#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
3303#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
3304#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
3306#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_F
3307#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_F BSLSTL_OPTIONAL_VARIADIC_LIMIT
3309#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0
3315#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1
3316 template <
class t_ARGS_01>
3323#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2
3324 template <
class t_ARGS_01,
3333#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3
3334 template <
class t_ARGS_01,
3345#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4
3346 template <
class t_ARGS_01,
3359#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5
3360 template <
class t_ARGS_01,
3375#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6
3376 template <
class t_ARGS_01,
3393#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7
3394 template <
class t_ARGS_01,
3413#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8
3414 template <
class t_ARGS_01,
3435#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9
3436 template <
class t_ARGS_01,
3459#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10
3460 template <
class t_ARGS_01,
3486# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3487#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0
3488 template <
class t_INIT_LIST_TYPE>
3492 std::initializer_list<t_INIT_LIST_TYPE>);
3495#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1
3496 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
3500 std::initializer_list<t_INIT_LIST_TYPE>,
3504#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2
3505 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3510 std::initializer_list<t_INIT_LIST_TYPE>,
3515#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3
3516 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3522 std::initializer_list<t_INIT_LIST_TYPE>,
3528#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4
3529 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3536 std::initializer_list<t_INIT_LIST_TYPE>,
3543#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5
3544 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3552 std::initializer_list<t_INIT_LIST_TYPE>,
3560#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6
3561 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3570 std::initializer_list<t_INIT_LIST_TYPE>,
3579#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7
3580 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3590 std::initializer_list<t_INIT_LIST_TYPE>,
3600#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8
3601 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3612 std::initializer_list<t_INIT_LIST_TYPE>,
3623#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9
3624 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3636 std::initializer_list<t_INIT_LIST_TYPE>,
3648#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10
3649 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3662 std::initializer_list<t_INIT_LIST_TYPE>,
3679 template <
class... t_ARGS>
3685# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3686 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
3690 std::initializer_list<t_INIT_LIST_TYPE>,
3701 template <
class t_ANY_TYPE>
3704# ifndef BDE_OMIT_INTERNAL_DEPRECATED
3744 BloombergLP::bslmf::IsBitwiseMoveable,
3745 BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
3748 BloombergLP::bslmf::IsBitwiseCopyable,
3749 BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
3752#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
3755#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
3756#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
3758#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_G
3759#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_G BSLSTL_OPTIONAL_VARIADIC_LIMIT
3761#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0
3765#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1
3766 template <
class t_ARGS_01>
3770#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2
3771 template <
class t_ARGS_01,
3777#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3
3778 template <
class t_ARGS_01,
3786#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4
3787 template <
class t_ARGS_01,
3797#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5
3798 template <
class t_ARGS_01,
3810#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6
3811 template <
class t_ARGS_01,
3825#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7
3826 template <
class t_ARGS_01,
3842#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8
3843 template <
class t_ARGS_01,
3861#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9
3862 template <
class t_ARGS_01,
3882#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10
3883 template <
class t_ARGS_01,
3906# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3907#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0
3908 template <
class t_INIT_LIST_TYPE>
3909 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il);
3912#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1
3913 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
3914 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3918#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2
3919 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3921 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3926#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3
3927 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3930 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3936#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4
3937 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3941 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3948#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5
3949 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3954 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3962#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6
3963 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3969 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3978#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7
3979 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
3986 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3996#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8
3997 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4005 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
4016#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9
4017 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4026 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
4038#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10
4039 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4049 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
4066 template <
class... t_ARGS>
4069# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4070 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
4071 t_TYPE&
emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
4087 bsl::is_nothrow_move_constructible<t_TYPE>::
value &&
4088 bsl::is_nothrow_swappable<t_TYPE>::
value);
4090# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4095 t_TYPE&&
value() &&;
4103# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4109 template <
class t_ANY_TYPE>
4123 BloombergLP::bslmf::MovableRef<Optional_Base> rhs);
4130# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4142 t_TYPE& operator*();
4150# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4154 const t_TYPE&
value() const &;
4155 const t_TYPE&&
value() const &&;
4160 const t_TYPE& value() const;
4163# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4169 template <
class t_ANY_TYPE>
4178 template <class t_ANY_TYPE>
4188# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4194 const t_TYPE&& operator*() const&&;
4200 const t_TYPE& operator*() const;
4203#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
4211 return UnspecifiedBoolUtil::makeValue(
has_value());
4230template <
class t_TYPE>
4231class optional :
public BloombergLP::bslstl::Optional_Base<t_TYPE> {
4234 typedef BloombergLP::bslstl::Optional_Base<t_TYPE> BaseType;
4236 typedef typename BaseType::AllocType AllocType;
4238 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
4240#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
4242 template <
class t_ANY_TYPE>
friend class optional;
4248 template <
class t_INVOCABLE,
class t_ARG>
4249 optional(BloombergLP::bslstl::Optional_InvokeConstructorTag ,
4250 t_INVOCABLE&& invocable,
4258 BloombergLP::bslma::UsesBslmaAllocator,
4259 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value);
4262 BloombergLP::bslmf::UsesAllocatorArgT,
4263 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value);
4266 BloombergLP::bslmf::IsBitwiseMoveable,
4267 BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
4270 BloombergLP::bslmf::IsBitwiseCopyable,
4271 BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
4286#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
4299 template <
class t_DERIVED>
4300 optional(BloombergLP::bslmf::MovableRef<t_DERIVED> original,
4315 template <
class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
4322 template <
class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
4340 template <
class t_ANY_TYPE>
4342 const optional<t_ANY_TYPE>& original,
4347 const t_ANY_TYPE&));
4349 template <
class t_ANY_TYPE>
4351 const optional<t_ANY_TYPE>& original,
4356 const t_ANY_TYPE&));
4371 template <
class t_ANY_TYPE>
4378 template <
class t_ANY_TYPE>
4385# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
4396 template <
class t_ANY_TYPE>
4398 const std::optional<t_ANY_TYPE>& original,
4405 template <
class t_ANY_TYPE>
4407 const std::optional<t_ANY_TYPE>& original,
4423 template <
class t_ANY_TYPE>
4425 std::optional<t_ANY_TYPE>&& original,
4430 template <
class t_ANY_TYPE>
4432 std::optional<t_ANY_TYPE>&& original,
4438#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
4441#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
4442#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
4444#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_H
4445#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_H BSLSTL_OPTIONAL_VARIADIC_LIMIT
4447#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0
4452#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1
4453 template <
class t_ARGS_01>
4459#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2
4460 template <
class t_ARGS_01,
4468#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3
4469 template <
class t_ARGS_01,
4479#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4
4480 template <
class t_ARGS_01,
4492#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5
4493 template <
class t_ARGS_01,
4507#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6
4508 template <
class t_ARGS_01,
4524#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7
4525 template <
class t_ARGS_01,
4543#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8
4544 template <
class t_ARGS_01,
4564#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9
4565 template <
class t_ARGS_01,
4587#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10
4588 template <
class t_ARGS_01,
4613# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4614#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0
4615 template <
class t_INIT_LIST_TYPE>
4618 std::initializer_list<t_INIT_LIST_TYPE> il);
4621#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1
4622 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
4625 std::initializer_list<t_INIT_LIST_TYPE> il,
4629#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2
4630 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4634 std::initializer_list<t_INIT_LIST_TYPE> il,
4639#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3
4640 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4645 std::initializer_list<t_INIT_LIST_TYPE> il,
4651#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4
4652 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4658 std::initializer_list<t_INIT_LIST_TYPE> il,
4665#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5
4666 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4673 std::initializer_list<t_INIT_LIST_TYPE> il,
4681#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6
4682 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4690 std::initializer_list<t_INIT_LIST_TYPE> il,
4699#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7
4700 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4709 std::initializer_list<t_INIT_LIST_TYPE> il,
4719#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8
4720 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4730 std::initializer_list<t_INIT_LIST_TYPE> il,
4741#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9
4742 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4753 std::initializer_list<t_INIT_LIST_TYPE> il,
4765#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10
4766 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
4778 std::initializer_list<t_INIT_LIST_TYPE> il,
4795 template <
class... t_ARGS>
4800# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4801 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
4804 std::initializer_list<t_INIT_LIST_TYPE> il,
4826 AllocType allocator,
4839 template <
class t_DERIVED>
4841 AllocType allocator,
4853 template <
class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
4855 AllocType allocator,
4860 template <
class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
4863 AllocType allocator,
4877 template <
class t_ANY_TYPE>
4880 AllocType allocator,
4881 const optional<t_ANY_TYPE>& original,
4886 const t_ANY_TYPE&));
4887 template <
class t_ANY_TYPE>
4890 AllocType allocator,
4891 const optional<t_ANY_TYPE>& original,
4896 const t_ANY_TYPE&));
4908 template <
class t_ANY_TYPE>
4911 AllocType allocator,
4916 template <
class t_ANY_TYPE>
4919 AllocType allocator,
4925# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
4935 template <
class t_ANY_TYPE>
4938 AllocType allocator,
4939 const std::optional<t_ANY_TYPE>& original,
4944 const t_ANY_TYPE&));
4945 template <
class t_ANY_TYPE>
4948 AllocType allocator,
4949 const std::optional<t_ANY_TYPE>& original,
4966 template <
class t_ANY_TYPE>
4969 AllocType allocator,
4970 std::optional<t_ANY_TYPE>&& original,
4974 template <
class t_ANY_TYPE>
4977 AllocType allocator,
4978 std::optional<t_ANY_TYPE>&& original,
4984#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
4987#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
4988#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
4990#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_I
4991#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_I BSLSTL_OPTIONAL_VARIADIC_LIMIT
4993#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0
4995 AllocType allocator,
4999#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1
5000 template <
class t_ARGS_01>
5002 AllocType allocator,
5007#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2
5008 template <
class t_ARGS_01,
5011 AllocType allocator,
5017#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3
5018 template <
class t_ARGS_01,
5022 AllocType allocator,
5029#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4
5030 template <
class t_ARGS_01,
5035 AllocType allocator,
5043#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5
5044 template <
class t_ARGS_01,
5050 AllocType allocator,
5059#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6
5060 template <
class t_ARGS_01,
5067 AllocType allocator,
5077#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7
5078 template <
class t_ARGS_01,
5086 AllocType allocator,
5097#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8
5098 template <
class t_ARGS_01,
5107 AllocType allocator,
5119#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9
5120 template <
class t_ARGS_01,
5130 AllocType allocator,
5143#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10
5144 template <
class t_ARGS_01,
5155 AllocType allocator,
5170# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
5171#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0
5172 template <
class t_INIT_LIST_TYPE>
5174 AllocType allocator,
5176 std::initializer_list<t_INIT_LIST_TYPE> il);
5179#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1
5180 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
5182 AllocType allocator,
5184 std::initializer_list<t_INIT_LIST_TYPE> il,
5188#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2
5189 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5192 AllocType allocator,
5194 std::initializer_list<t_INIT_LIST_TYPE> il,
5199#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3
5200 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5204 AllocType allocator,
5206 std::initializer_list<t_INIT_LIST_TYPE> il,
5212#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4
5213 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5218 AllocType allocator,
5220 std::initializer_list<t_INIT_LIST_TYPE> il,
5227#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5
5228 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5234 AllocType allocator,
5236 std::initializer_list<t_INIT_LIST_TYPE> il,
5244#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6
5245 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5252 AllocType allocator,
5254 std::initializer_list<t_INIT_LIST_TYPE> il,
5263#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7
5264 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5272 AllocType allocator,
5274 std::initializer_list<t_INIT_LIST_TYPE> il,
5284#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8
5285 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5294 AllocType allocator,
5296 std::initializer_list<t_INIT_LIST_TYPE> il,
5307#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9
5308 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5318 AllocType allocator,
5320 std::initializer_list<t_INIT_LIST_TYPE> il,
5332#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10
5333 template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
5344 AllocType allocator,
5346 std::initializer_list<t_INIT_LIST_TYPE> il,
5363 template <
class... t_ARGS>
5365 AllocType allocator,
5369# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
5370 template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
5372 AllocType allocator,
5374 std::initializer_list<t_INIT_LIST_TYPE> il,
5393#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
5403 template <
class t_DERIVED>
5405 operator=(BloombergLP::bslmf::MovableRef<t_DERIVED>
rhs);
5417 template <
class t_ANY_TYPE>
5431 template <
class t_ANY_TYPE>
5436#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
5449 template <
class t_ANY_TYPE = t_TYPE>
5474 template <
class t_ANY_TYPE>
5478 template <
class t_ANY_TYPE>
5480 operator=(BloombergLP::bslmf::MovableRef<t_ANY_TYPE>
rhs);
5483#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
5492 template <
class t_ANY_TYPE = t_TYPE>
5505 template <
class t_ANY_TYPE = t_TYPE>
5511#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
5515 #define BSLSTL_OPTIONAL_PROVIDES_MONADICS
5527 template <
class t_FUNC>
constexpr auto transform(t_FUNC&& func) &;
5528 template <
class t_FUNC>
constexpr auto transform(t_FUNC&& func) &&;
5529 template <
class t_FUNC>
constexpr auto transform(t_FUNC&& func)
const &;
5530 template <
class t_FUNC>
constexpr auto transform(t_FUNC&& func)
const &&;
5541 template <
class t_FUNC>
constexpr auto and_then(t_FUNC&& func) &;
5542 template <
class t_FUNC>
constexpr auto and_then(t_FUNC&& func) &&;
5543 template <
class t_FUNC>
constexpr auto and_then(t_FUNC&& func)
const &;
5544 template <
class t_FUNC>
constexpr auto and_then(t_FUNC&& func)
const &&;
5552 template <
class t_FUNC>
5554 enable_if_t<conjunction_v<std::is_invocable<t_FUNC>,
5555 std::is_copy_constructible<t_TYPE>>,
5556 optional> or_else(t_FUNC&& func)
const &;
5565 template <
class t_FUNC>
5567 enable_if_t<conjunction_v<std::is_invocable<t_FUNC>,
5568 std::is_move_constructible<t_TYPE>>,
5569 optional> or_else(t_FUNC&& func) &&;
5582template <
class t_TYPE>
5583struct UsesBslmaAllocator<
bslstl::Optional_Base<t_TYPE, false> >
5587template <
class t_TYPE>
5588struct UsesBslmaAllocator<
bsl::optional<t_TYPE> >
5589: UsesBslmaAllocator<t_TYPE> {
5601# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
5606template <
class t_TYPE>
5607optional(t_TYPE) -> optional<t_TYPE>;
5614template <
class t_TYPE,
5616 class =
typename bsl::enable_if_t<
5617 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>,
5618 class =
typename bsl::enable_if_t<
5619 bsl::is_convertible_v<t_ALLOC, bsl::allocator<char>>>
5629template <
class t_TYPE,
5631 class =
typename bsl::enable_if_t<
5632 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>,
5633 class =
typename bsl::enable_if_t<
5634 bsl::is_convertible_v<t_ALLOC, bsl::allocator<char>>>
5650template <
class t_TYPE>
5659template <
class t_TYPE>
5669template <
class t_HASHALG,
class t_TYPE>
5670void hashAppend(t_HASHALG& hashAlg,
const optional<t_TYPE>& input);
5680template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5685 { *
lhs == *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5694template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5699 { *
lhs != *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5708template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5713 { *
lhs < *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5722template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5727 { *
lhs > *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5735template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5740 { *
lhs <= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5748template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5753 { *
lhs >= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5761template <
class t_TYPE>
5765#if !(defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) && \
5766 defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS))
5767template <
class t_TYPE>
5775template <
class t_TYPE>
5779template <
class t_TYPE>
5788template <
class t_TYPE>
5798template <
class t_TYPE>
5806template <
class t_TYPE>
5815template <
class t_TYPE>
5823template <
class t_TYPE>
5832template <
class t_TYPE>
5841template <
class t_TYPE>
5849template <
class t_TYPE>
5864template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5867 const t_RHS_TYPE&
rhs)
5869 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5871 { *
lhs ==
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5873template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5878 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5880 {
lhs == *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5889template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5892 const t_RHS_TYPE&
rhs)
5894 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5896 { *
lhs !=
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5898template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5903 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5905 {
lhs != *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5913template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5917 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5919 { *
lhs <
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5927template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5931 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5933 {
lhs < *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5941template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5945 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5947 { *
lhs >
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5955template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5959 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5961 {
lhs > *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5968template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5972 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5974 { *
lhs <=
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5981template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5985 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5987 {
lhs <= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5994template <
class t_LHS_TYPE,
class t_RHS_TYPE>
5998 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
6000 { *
lhs >=
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6007template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6011 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
6013 {
lhs >= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6016#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
6017 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
6023template <
class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
6025compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
6033template <
class t_LHS,
class t_RHS>
6034requires (!BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS>) &&
6035 three_way_comparable_with<t_LHS, t_RHS>
6037compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
6044template <
class t_TYPE>
6053template <
class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
6055compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
6057 const std::optional<t_RHS>&
rhs);
6060# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
6067template <
class t_TYPE>
6071template <
class t_TYPE>
6087template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6088constexpr bool operator==(
const std::optional<t_LHS_TYPE>&
lhs,
6091 { *
lhs == *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6093template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6095 const std::optional<t_RHS_TYPE>&
rhs)
6097 { *
lhs == *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6109template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6111 const std::optional<t_RHS_TYPE>&
rhs)
6113 { *
lhs != *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6115template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6116constexpr bool operator!=(
const std::optional<t_LHS_TYPE>&
lhs,
6119 { *
lhs != *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6131template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6133 const std::optional<t_RHS_TYPE>&
rhs)
6135 { *
lhs < *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6137template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6138constexpr bool operator<(
const std::optional<t_LHS_TYPE>&
lhs,
6141 { *
lhs < *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6152template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6154 const std::optional<t_RHS_TYPE>&
rhs)
6156 { *
lhs > *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6158template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6159constexpr bool operator>(
const std::optional<t_LHS_TYPE>&
lhs,
6162 { *
lhs > *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6172template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6174 const std::optional<t_RHS_TYPE>&
rhs)
6176 { *
lhs <= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6178template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6179constexpr bool operator<=(
const std::optional<t_LHS_TYPE>&
lhs,
6182 { *
lhs <= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6192template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6194 const std::optional<t_RHS_TYPE>&
rhs)
6196 { *
lhs >= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6198template <
class t_LHS_TYPE,
class t_RHS_TYPE>
6199constexpr bool operator>=(
const std::optional<t_LHS_TYPE>&
lhs,
6202 { *
lhs >= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
6212template <
class t_TYPE>
6219#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
6222#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
6223#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
6225#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_J
6226#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_J BSLSTL_OPTIONAL_VARIADIC_LIMIT
6228#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0
6229template <
class t_TYPE>
6235#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1
6236template <
class t_TYPE,
class t_ARGS_01>
6243#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2
6244template <
class t_TYPE,
class t_ARGS_01,
6253#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3
6254template <
class t_TYPE,
class t_ARGS_01,
6265#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4
6266template <
class t_TYPE,
class t_ARGS_01,
6279#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5
6280template <
class t_TYPE,
class t_ARGS_01,
6295#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6
6296template <
class t_TYPE,
class t_ARGS_01,
6313#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7
6314template <
class t_TYPE,
class t_ARGS_01,
6333#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8
6334template <
class t_TYPE,
class t_ARGS_01,
6355#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9
6356template <
class t_TYPE,
class t_ARGS_01,
6379#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10
6380template <
class t_TYPE,
class t_ARGS_01,
6406# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
6407#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0
6408template <
class t_TYPE,
class t_INIT_LIST_TYPE>
6412 std::initializer_list<t_INIT_LIST_TYPE> il);
6415#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1
6416template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01>
6420 std::initializer_list<t_INIT_LIST_TYPE> il,
6424#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2
6425template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6430 std::initializer_list<t_INIT_LIST_TYPE> il,
6435#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3
6436template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6442 std::initializer_list<t_INIT_LIST_TYPE> il,
6448#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4
6449template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6456 std::initializer_list<t_INIT_LIST_TYPE> il,
6463#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5
6464template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6472 std::initializer_list<t_INIT_LIST_TYPE> il,
6480#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6
6481template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6490 std::initializer_list<t_INIT_LIST_TYPE> il,
6499#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7
6500template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6510 std::initializer_list<t_INIT_LIST_TYPE> il,
6520#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8
6521template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6532 std::initializer_list<t_INIT_LIST_TYPE> il,
6543#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9
6544template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6556 std::initializer_list<t_INIT_LIST_TYPE> il,
6568#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10
6569template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6582 std::initializer_list<t_INIT_LIST_TYPE> il,
6599template <
class t_TYPE,
class... t_ARGS>
6605# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
6606template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class... t_ARGS>
6610 std::initializer_list<t_INIT_LIST_TYPE> il,
6621template <
class t_TYPE>
6629template <
class t_TYPE>
6632#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
6635#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
6636#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
6638#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_K
6639#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_K BSLSTL_OPTIONAL_VARIADIC_LIMIT
6641#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0
6642template <
class t_TYPE,
class t_ARG>
6647#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1
6648template <
class t_TYPE,
class t_ARG,
class t_ARGS_01>
6654#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2
6655template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6663#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3
6664template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6674#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4
6675template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6687#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5
6688template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6702#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6
6703template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6719#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7
6720template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6738#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8
6739template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6759#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9
6760template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6782#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10
6783template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
6808# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
6809#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0
6810template <
class t_TYPE,
class t_INIT_LIST_TYPE>
6815#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1
6816template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01>
6822#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2
6823template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6831#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3
6832template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6842#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4
6843template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6855#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5
6856template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6870#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6
6871template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6887#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7
6888template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6906#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8
6907template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6927#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9
6928template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6950#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10
6951template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
6980template <
class t_TYPE,
class t_ARG,
class... t_ARGS>
6985# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
6986template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class... t_ARGS>
7013template <
class t_TYPE>
7019#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
7020template <
class t_TYPE>
7021template <
class t_INVOCABLE,
class t_ARG>
7024 Optional_InvokeConstructorTag ,
7025 t_INVOCABLE&& invocable,
7030 ::new((
void*)d_buffer.
address()) t_TYPE(
7031 std::invoke(
std::forward<t_INVOCABLE>(invocable),
7032 std::forward<t_ARG>(arg)));
7038#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
7041#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
7042#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
7044#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_L
7045#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_L BSLSTL_OPTIONAL_VARIADIC_LIMIT
7047#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0
7048template <
class t_TYPE>
7050t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7054 BloombergLP::bslma::ConstructionUtil::construct(
7058 return d_buffer.
object();
7062#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1
7063template <
class t_TYPE>
7064template <
class t_ARGS_01>
7066t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7071 BloombergLP::bslma::ConstructionUtil::construct(
7076 return d_buffer.
object();
7080#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2
7081template <
class t_TYPE>
7082template <
class t_ARGS_01,
7085t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7091 BloombergLP::bslma::ConstructionUtil::construct(
7097 return d_buffer.
object();
7101#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3
7102template <
class t_TYPE>
7103template <
class t_ARGS_01,
7107t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7114 BloombergLP::bslma::ConstructionUtil::construct(
7121 return d_buffer.
object();
7125#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4
7126template <
class t_TYPE>
7127template <
class t_ARGS_01,
7132t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7140 BloombergLP::bslma::ConstructionUtil::construct(
7148 return d_buffer.
object();
7152#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5
7153template <
class t_TYPE>
7154template <
class t_ARGS_01,
7160t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7169 BloombergLP::bslma::ConstructionUtil::construct(
7178 return d_buffer.
object();
7182#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6
7183template <
class t_TYPE>
7184template <
class t_ARGS_01,
7191t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7201 BloombergLP::bslma::ConstructionUtil::construct(
7211 return d_buffer.
object();
7215#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7
7216template <
class t_TYPE>
7217template <
class t_ARGS_01,
7225t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7236 BloombergLP::bslma::ConstructionUtil::construct(
7247 return d_buffer.
object();
7251#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8
7252template <
class t_TYPE>
7253template <
class t_ARGS_01,
7262t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7274 BloombergLP::bslma::ConstructionUtil::construct(
7286 return d_buffer.
object();
7290#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9
7291template <
class t_TYPE>
7292template <
class t_ARGS_01,
7302t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7315 BloombergLP::bslma::ConstructionUtil::construct(
7328 return d_buffer.
object();
7332#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10
7333template <
class t_TYPE>
7334template <
class t_ARGS_01,
7345t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7359 BloombergLP::bslma::ConstructionUtil::construct(
7373 return d_buffer.
object();
7378# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
7379#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0
7380template <
class t_TYPE>
7381template <
class t_INIT_LIST_TYPE>
7382t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7384 std::initializer_list<t_INIT_LIST_TYPE> il)
7387 BloombergLP::bslma::ConstructionUtil::construct(
7392 return d_buffer.
object();
7396#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1
7397template <
class t_TYPE>
7398template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
7399t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7401 std::initializer_list<t_INIT_LIST_TYPE> il,
7405 BloombergLP::bslma::ConstructionUtil::construct(
7411 return d_buffer.
object();
7415#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2
7416template <
class t_TYPE>
7417template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7419t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7421 std::initializer_list<t_INIT_LIST_TYPE> il,
7426 BloombergLP::bslma::ConstructionUtil::construct(
7433 return d_buffer.
object();
7437#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3
7438template <
class t_TYPE>
7439template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7442t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7444 std::initializer_list<t_INIT_LIST_TYPE> il,
7450 BloombergLP::bslma::ConstructionUtil::construct(
7458 return d_buffer.
object();
7462#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4
7463template <
class t_TYPE>
7464template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7468t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7470 std::initializer_list<t_INIT_LIST_TYPE> il,
7477 BloombergLP::bslma::ConstructionUtil::construct(
7486 return d_buffer.
object();
7490#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5
7491template <
class t_TYPE>
7492template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7497t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7499 std::initializer_list<t_INIT_LIST_TYPE> il,
7507 BloombergLP::bslma::ConstructionUtil::construct(
7517 return d_buffer.
object();
7521#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6
7522template <
class t_TYPE>
7523template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7529t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7531 std::initializer_list<t_INIT_LIST_TYPE> il,
7540 BloombergLP::bslma::ConstructionUtil::construct(
7551 return d_buffer.
object();
7555#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7
7556template <
class t_TYPE>
7557template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7564t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7566 std::initializer_list<t_INIT_LIST_TYPE> il,
7576 BloombergLP::bslma::ConstructionUtil::construct(
7588 return d_buffer.
object();
7592#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8
7593template <
class t_TYPE>
7594template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7602t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7604 std::initializer_list<t_INIT_LIST_TYPE> il,
7615 BloombergLP::bslma::ConstructionUtil::construct(
7628 return d_buffer.
object();
7632#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9
7633template <
class t_TYPE>
7634template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7643t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7645 std::initializer_list<t_INIT_LIST_TYPE> il,
7657 BloombergLP::bslma::ConstructionUtil::construct(
7671 return d_buffer.
object();
7675#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10
7676template <
class t_TYPE>
7677template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
7687t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7689 std::initializer_list<t_INIT_LIST_TYPE> il,
7702 BloombergLP::bslma::ConstructionUtil::construct(
7717 return d_buffer.
object();
7725template <
class t_TYPE>
7726template <
class... t_ARGS>
7728t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7733 BloombergLP::bslma::ConstructionUtil::construct(
7738 return d_buffer.
object();
7741# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
7742template <
class t_TYPE>
7743template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
7744t_TYPE& Optional_DataImp<t_TYPE>::emplace(
7746 std::initializer_list<t_INIT_LIST_TYPE> il,
7750 BloombergLP::bslma::ConstructionUtil::construct(
7756 return d_buffer.
object();
7762template <
class t_TYPE>
7767 bslma::DestructionUtil::destroy(d_buffer.
address());
7771# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
7772template <
class t_TYPE>
7774t_TYPE& Optional_DataImp<t_TYPE>::value() &
7779 return d_buffer.
object();
7782template <
class t_TYPE>
7784t_TYPE&& Optional_DataImp<t_TYPE>::value() &&
7789 return std::move(d_buffer.
object());
7792template <
class t_TYPE>
7794t_TYPE& Optional_DataImp<t_TYPE>::value()
7799 return d_buffer.
object();
7804template <
class t_TYPE>
7808#ifdef BSLS_PLATFORM_CMP_GNU
7809# pragma GCC diagnostic push
7810# pragma GCC diagnostic ignored "-Warray-bounds"
7813#ifdef BSLS_PLATFORM_CMP_GNU
7814# pragma GCC diagnostic pop
7818# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
7819template <
class t_TYPE>
7821const t_TYPE& Optional_DataImp<t_TYPE>::value() const&
7826 return d_buffer.
object();
7829template <
class t_TYPE>
7831const t_TYPE&& Optional_DataImp<t_TYPE>::value() const&&
7836 return std::move(d_buffer.
object());
7839template <
class t_TYPE>
7841const t_TYPE& Optional_DataImp<t_TYPE>::value()
const
7846 return d_buffer.
object();
7855template <
class t_TYPE,
bool t_IS_TRIVIALLY_DESTRUCTIBLE>
7856Optional_Data<t_TYPE, t_IS_TRIVIALLY_DESTRUCTIBLE>::~Optional_Data()
7870template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7872Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base()
7876template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7878Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
bsl::nullopt_t)
7882template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7884Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7885 const Optional_Base& original)
7887 if (original.has_value()) {
7892template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7894Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7895 BloombergLP::bslmf::MovableRef<Optional_Base> original)
7898: d_allocator(MoveUtil::access(original).get_allocator())
7900 Optional_Base& lvalue = original;
7902 if (lvalue.has_value()) {
7903 emplace(MoveUtil::move(*lvalue));
7907template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7908template <
class t_ANY_TYPE>
7910Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7911 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
7917template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7918template <
class t_ANY_TYPE>
7920Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7921 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
7922 const Optional_Base<t_ANY_TYPE>& original)
7924 if (original.has_value()) {
7925 emplace(original.value());
7929template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7930template <
class t_ANY_TYPE>
7932Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7933 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
7938 Optional_Base<t_ANY_TYPE>& lvalue = original;
7939 if (lvalue.has_value()) {
7940 emplace(MoveUtil::move(*lvalue));
7944template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7945template <
class t_ANY_TYPE>
7947Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7948 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
7952: d_allocator(MoveUtil::access(original).get_allocator())
7954 Optional_Base<t_ANY_TYPE>& lvalue = original;
7955 if (lvalue.has_value()) {
7956 emplace(MoveUtil::move(*lvalue));
7960# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
7961template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7962template <
class t_ANY_TYPE>
7964Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7965 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
7966 const std::optional<t_ANY_TYPE>& original)
7968 if (original.has_value()) {
7969 emplace(original.value());
7973template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7974template <
class t_ANY_TYPE>
7976Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7977 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
7978 std::optional<t_ANY_TYPE>&& original)
7980 if (original.has_value()) {
7981 emplace(std::move(original.value()));
7986#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
7989#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
7990#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
7992#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_M
7993#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_M BSLSTL_OPTIONAL_VARIADIC_LIMIT
7995#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0
7996template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
7998Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8005#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1
8006template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8007template <
class t_ARGS_01>
8009Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8017#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2
8018template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8019template <
class t_ARGS_01,
8022Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8032#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3
8033template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8034template <
class t_ARGS_01,
8038Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8050#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4
8051template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8052template <
class t_ARGS_01,
8057Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8071#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5
8072template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8073template <
class t_ARGS_01,
8079Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8095#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6
8096template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8097template <
class t_ARGS_01,
8104Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8122#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7
8123template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8124template <
class t_ARGS_01,
8132Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8152#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8
8153template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8154template <
class t_ARGS_01,
8163Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8185#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9
8186template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8187template <
class t_ARGS_01,
8197Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8221#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10
8222template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8223template <
class t_ARGS_01,
8234Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8261# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
8262#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0
8263template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8264template <
class t_INIT_LIST_TYPE>
8266Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8268 std::initializer_list<t_INIT_LIST_TYPE> il)
8274#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1
8275template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8276template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
8278Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8280 std::initializer_list<t_INIT_LIST_TYPE> il,
8287#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2
8288template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8289template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8292Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8294 std::initializer_list<t_INIT_LIST_TYPE> il,
8303#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3
8304template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8305template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8309Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8311 std::initializer_list<t_INIT_LIST_TYPE> il,
8322#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4
8323template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8324template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8329Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8331 std::initializer_list<t_INIT_LIST_TYPE> il,
8344#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5
8345template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8346template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8352Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8354 std::initializer_list<t_INIT_LIST_TYPE> il,
8369#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6
8370template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8371template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8378Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8380 std::initializer_list<t_INIT_LIST_TYPE> il,
8397#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7
8398template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8399template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8407Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8409 std::initializer_list<t_INIT_LIST_TYPE> il,
8428#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8
8429template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8430template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8439Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8441 std::initializer_list<t_INIT_LIST_TYPE> il,
8462#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9
8463template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8464template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8474Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8476 std::initializer_list<t_INIT_LIST_TYPE> il,
8499#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10
8500template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8501template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
8512Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8514 std::initializer_list<t_INIT_LIST_TYPE> il,
8543template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8544template <
class... t_ARGS>
8546Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8553# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
8554template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8555template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
8557Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8559 std::initializer_list<t_INIT_LIST_TYPE> il,
8568#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
8569template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8570template <
class t_INVOCABLE,
class t_ARG>
8572Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8573 Optional_InvokeConstructorTag tag,
8574 t_INVOCABLE&& invocable,
8576: d_value(tag,
std::forward<t_INVOCABLE>(invocable),
std::forward<t_ARG>(arg))
8577, d_allocator(
bslma::AATypeUtil::getAllocatorFromSubobject<allocator_type>(
8583template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8585Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8587 allocator_type allocator)
8588: d_allocator(allocator)
8592template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8594Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8596 allocator_type allocator,
8598: d_allocator(allocator)
8602template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8604Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8606 allocator_type allocator,
8607 const Optional_Base& original)
8608: d_allocator(allocator)
8610 if (original.has_value()) {
8615template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8617Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8619 allocator_type allocator,
8620 BloombergLP::bslmf::MovableRef<Optional_Base> original)
8621: d_allocator(allocator)
8623 Optional_Base& lvalue = original;
8625 if (lvalue.has_value()) {
8626 emplace(MoveUtil::move(*lvalue));
8630template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8631template <
class t_ANY_TYPE>
8633Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8635 allocator_type allocator,
8636 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
8638: d_allocator(allocator)
8643template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8644template <
class t_ANY_TYPE>
8646Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8648 allocator_type allocator,
8649 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
8650 const Optional_Base<t_ANY_TYPE>& original)
8651: d_allocator(allocator)
8653 if (original.has_value()) {
8654 emplace(original.value());
8658template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8659template <
class t_ANY_TYPE>
8661Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8663 allocator_type allocator,
8664 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
8666: d_allocator(allocator)
8668 Optional_Base<t_ANY_TYPE>& lvalue = original;
8669 if (lvalue.has_value()) {
8670 emplace(MoveUtil::move(*lvalue));
8674# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
8675template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8676template <
class t_ANY_TYPE>
8678Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8680 allocator_type allocator,
8681 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
8682 const std::optional<t_ANY_TYPE>& original)
8683: d_allocator(allocator)
8685 if (original.has_value()) {
8686 emplace(original.value());
8690template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8691template <
class t_ANY_TYPE>
8693Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8695 allocator_type allocator,
8696 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
8697 std::optional<t_ANY_TYPE>&& original)
8698: d_allocator(allocator)
8700 if (original.has_value()) {
8701 emplace(std::move(original.value()));
8706#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
8709#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
8710#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
8712#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_N
8713#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_N BSLSTL_OPTIONAL_VARIADIC_LIMIT
8715#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0
8716template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8718Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8720 allocator_type alloc,
8728#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1
8729template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8730template <
class t_ARGS_01>
8732Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8734 allocator_type alloc,
8743#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2
8744template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8745template <
class t_ARGS_01,
8748Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8750 allocator_type alloc,
8761#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3
8762template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8763template <
class t_ARGS_01,
8767Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8769 allocator_type alloc,
8782#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4
8783template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8784template <
class t_ARGS_01,
8789Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8791 allocator_type alloc,
8806#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5
8807template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8808template <
class t_ARGS_01,
8814Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8816 allocator_type alloc,
8833#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6
8834template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8835template <
class t_ARGS_01,
8842Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8844 allocator_type alloc,
8863#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7
8864template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8865template <
class t_ARGS_01,
8873Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8875 allocator_type alloc,
8896#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8
8897template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8898template <
class t_ARGS_01,
8907Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8909 allocator_type alloc,
8932#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9
8933template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8934template <
class t_ARGS_01,
8944Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8946 allocator_type alloc,
8971#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10
8972template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
8973template <
class t_ARGS_01,
8984Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8986 allocator_type alloc,
9014# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
9015#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0
9016template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9017template <
class t_INIT_LIST_TYPE>
9019Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9021 allocator_type alloc,
9023 std::initializer_list<t_INIT_LIST_TYPE> il)
9030#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1
9031template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9032template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
9034Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9036 allocator_type alloc,
9038 std::initializer_list<t_INIT_LIST_TYPE> il,
9046#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2
9047template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9048template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9051Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9053 allocator_type alloc,
9055 std::initializer_list<t_INIT_LIST_TYPE> il,
9065#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3
9066template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9067template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9071Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9073 allocator_type alloc,
9075 std::initializer_list<t_INIT_LIST_TYPE> il,
9087#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4
9088template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9089template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9094Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9096 allocator_type alloc,
9098 std::initializer_list<t_INIT_LIST_TYPE> il,
9112#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5
9113template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9114template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9120Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9122 allocator_type alloc,
9124 std::initializer_list<t_INIT_LIST_TYPE> il,
9140#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6
9141template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9142template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9149Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9151 allocator_type alloc,
9153 std::initializer_list<t_INIT_LIST_TYPE> il,
9171#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7
9172template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9173template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9181Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9183 allocator_type alloc,
9185 std::initializer_list<t_INIT_LIST_TYPE> il,
9205#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8
9206template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9207template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9216Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9218 allocator_type alloc,
9220 std::initializer_list<t_INIT_LIST_TYPE> il,
9242#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9
9243template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9244template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9254Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9256 allocator_type alloc,
9258 std::initializer_list<t_INIT_LIST_TYPE> il,
9282#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10
9283template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9284template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9295Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9297 allocator_type alloc,
9299 std::initializer_list<t_INIT_LIST_TYPE> il,
9329template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9330template <
class... t_ARGS>
9332Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9334 allocator_type alloc,
9342# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
9343template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9344template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
9346Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
9348 allocator_type alloc,
9350 std::initializer_list<t_INIT_LIST_TYPE> il,
9361template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9362template <
class t_ANY_TYPE>
9363void Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::assignOrEmplace(
9373# ifndef BDE_OMIT_INTERNAL_DEPRECATED
9374template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9375t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::dereferenceRaw()
9380 return d_value.value();
9384template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9385const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::dereferenceRaw()
const
9390 return d_value.value();
9395#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
9398#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
9399#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
9401#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_O
9402#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_O BSLSTL_OPTIONAL_VARIADIC_LIMIT
9404#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0
9405template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9407t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9410 return d_value.emplace(d_allocator.mechanism());
9414#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1
9415template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9416template <
class t_ARGS_01>
9418t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9421 return d_value.emplace(d_allocator.mechanism(),
9426#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2
9427template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9428template <
class t_ARGS_01,
9431t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9435 return d_value.emplace(d_allocator.mechanism(),
9441#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3
9442template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9443template <
class t_ARGS_01,
9447t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9452 return d_value.emplace(d_allocator.mechanism(),
9459#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4
9460template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9461template <
class t_ARGS_01,
9466t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9472 return d_value.emplace(d_allocator.mechanism(),
9480#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5
9481template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9482template <
class t_ARGS_01,
9488t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9495 return d_value.emplace(d_allocator.mechanism(),
9504#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6
9505template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9506template <
class t_ARGS_01,
9513t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9521 return d_value.emplace(d_allocator.mechanism(),
9531#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7
9532template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9533template <
class t_ARGS_01,
9541t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9550 return d_value.emplace(d_allocator.mechanism(),
9561#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8
9562template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9563template <
class t_ARGS_01,
9572t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9582 return d_value.emplace(d_allocator.mechanism(),
9594#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9
9595template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9596template <
class t_ARGS_01,
9606t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9617 return d_value.emplace(d_allocator.mechanism(),
9630#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10
9631template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9632template <
class t_ARGS_01,
9643t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9655 return d_value.emplace(d_allocator.mechanism(),
9670# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
9671#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0
9672template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9673template <
class t_INIT_LIST_TYPE>
9674t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9675 std::initializer_list<t_INIT_LIST_TYPE> il)
9677 return d_value.emplace(d_allocator.mechanism(),
9682#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1
9683template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9684template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
9685t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9686 std::initializer_list<t_INIT_LIST_TYPE> il,
9689 return d_value.emplace(d_allocator.mechanism(),
9695#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2
9696template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9697template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9699t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9700 std::initializer_list<t_INIT_LIST_TYPE> il,
9704 return d_value.emplace(d_allocator.mechanism(),
9711#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3
9712template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9713template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9716t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9717 std::initializer_list<t_INIT_LIST_TYPE> il,
9722 return d_value.emplace(d_allocator.mechanism(),
9730#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4
9731template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9732template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9736t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9737 std::initializer_list<t_INIT_LIST_TYPE> il,
9743 return d_value.emplace(d_allocator.mechanism(),
9752#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5
9753template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9754template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9759t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9760 std::initializer_list<t_INIT_LIST_TYPE> il,
9767 return d_value.emplace(d_allocator.mechanism(),
9777#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6
9778template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9779template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9785t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9786 std::initializer_list<t_INIT_LIST_TYPE> il,
9794 return d_value.emplace(d_allocator.mechanism(),
9805#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7
9806template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9807template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9814t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9815 std::initializer_list<t_INIT_LIST_TYPE> il,
9824 return d_value.emplace(d_allocator.mechanism(),
9836#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8
9837template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9838template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9846t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9847 std::initializer_list<t_INIT_LIST_TYPE> il,
9857 return d_value.emplace(d_allocator.mechanism(),
9870#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9
9871template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9872template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9881t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9882 std::initializer_list<t_INIT_LIST_TYPE> il,
9893 return d_value.emplace(d_allocator.mechanism(),
9907#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10
9908template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9909template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
9919t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9920 std::initializer_list<t_INIT_LIST_TYPE> il,
9932 return d_value.emplace(d_allocator.mechanism(),
9951template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9952template <
class... t_ARGS>
9954t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9957 return d_value.emplace(d_allocator.mechanism(),
9961# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
9962template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9963template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
9964t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9965 std::initializer_list<t_INIT_LIST_TYPE> il,
9968 return d_value.emplace(d_allocator.mechanism(),
9976template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9983template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
9984void Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::swap(Optional_Base& other)
9987 bsl::is_nothrow_swappable<t_TYPE>::value)
9991 if (this->has_value() && other.has_value()) {
9992 BloombergLP::bslalg::SwapUtil::swap(
9996 else if (this->has_value()) {
9997 other.emplace(MoveUtil::move(d_value.value()));
10000 else if (other.has_value()) {
10001 this->emplace(MoveUtil::move(*other));
10006# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
10007template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10009t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() &
10014 return d_value.value();
10017template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10019t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() &&
10024 return std::move(d_value.value());
10028template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10030t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value()
10035 return d_value.value();
10040# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
10041template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10042template <
class t_ANY_TYPE>
10044t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
10045 t_ANY_TYPE&& value) &&
10048 return t_TYPE(std::move(d_value.value()));
10051 return t_TYPE(std::forward<t_ANY_TYPE>(value));
10055# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
10056template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10057template <
class t_ANY_TYPE>
10059t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
10061 allocator_type allocator,
10062 t_ANY_TYPE&& value) &&
10065 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
10067 std::move(d_value.value()));
10070 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
10072 std::forward<t_ANY_TYPE>(value));
10078template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10080Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>&
10081Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator=(
const Optional_Base& rhs)
10083 if (
rhs.has_value()) {
10084 if (this->has_value()) {
10085 d_value.value() = *
rhs;
10097template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10099Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>&
10100Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator=(
10101 BloombergLP::bslmf::MovableRef<Optional_Base> rhs)
10103 Optional_Base& lvalue =
rhs;
10105 if (lvalue.has_value()) {
10106 if (this->has_value()) {
10107 d_value.value() = MoveUtil::move(*lvalue);
10110 emplace(MoveUtil::move(*lvalue));
10119template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10121t_TYPE *Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator->()
10128# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
10129template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10131t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() &
10135 return d_value.value();
10138template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10140t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() &&
10144 return std::move(d_value.value());
10148template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10150t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*()
10154 return d_value.value();
10161template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10163typename Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::allocator_type
10164Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::get_allocator() const
10167 return d_allocator;
10170template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10173Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::has_value() const
10176 return d_value.hasValue();
10179# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
10180template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10182const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() const&
10187 return d_value.value();
10190template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10192const t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() const&&
10197 return std::move(d_value.value());
10201template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10203const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value()
const
10208 return d_value.value();
10213# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
10214template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10215template <
class t_ANY_TYPE>
10217t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
10221 return t_TYPE(d_value.value());
10229# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
10230template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10231template <
class t_ANY_TYPE>
10233t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
10235 allocator_type allocator,
10239 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
10240 allocator, d_value.value());
10243 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
10250template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10251template <
class t_ANY_TYPE>
10253t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
10257 return t_TYPE(d_value.value());
10265# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
10266template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10267template <
class t_ANY_TYPE>
10269t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
10271 allocator_type allocator,
10275 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
10276 allocator, d_value.value());
10279 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
10287template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10289const t_TYPE *Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator->()
const
10296# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
10297template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10299const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() const&
10303 return d_value.value();
10306template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10308const t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() const&&
10312 return std::move(d_value.value());
10316template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10318const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*()
const
10322 return d_value.value();
10326#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
10327template <
class t_TYPE,
bool t_USES_BSLMA_ALLOC>
10328Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator bool() const
10331 return has_value();
10343# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
10345template <
class t_TYPE>
10347Optional_Base<t_TYPE, false>::Optional_Base()
10351template <
class t_TYPE>
10357template <
class t_TYPE>
10358template <
class t_ANY_TYPE>
10360Optional_Base<t_TYPE, false>::Optional_Base(
10361 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
10362 t_ANY_TYPE&& value)
10363: StdOptionalBase(
std::forward<t_ANY_TYPE>(value))
10367template <
class t_TYPE>
10368template <
class t_ANY_TYPE>
10370Optional_Base<t_TYPE, false>::Optional_Base(
10371 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
10372 const Optional_Base<t_ANY_TYPE>& original)
10374 if (original.has_value()) {
10375 this->emplace(original.value());
10379template <
class t_TYPE>
10380template <
class t_ANY_TYPE>
10382Optional_Base<t_TYPE, false>::Optional_Base(
10383 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
10384 Optional_Base<t_ANY_TYPE>&& original)
10386 if (original.has_value()) {
10387 this->emplace(std::move(original.value()));
10391template <
class t_TYPE>
10392template <
class t_ANY_TYPE>
10394Optional_Base<t_TYPE, false>::Optional_Base(
10395 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
10396 const std::optional<t_ANY_TYPE>& original)
10397: StdOptionalBase(original)
10401template <
class t_TYPE>
10402template <
class t_ANY_TYPE>
10404Optional_Base<t_TYPE, false>::Optional_Base(
10405 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
10406 std::optional<t_ANY_TYPE>&& original)
10407: StdOptionalBase(
std::move(original))
10411template <
class t_TYPE>
10412template <
class... t_ARGS>
10414Optional_Base<t_TYPE, false>::Optional_Base(
bsl::in_place_t, t_ARGS&&... args)
10419template <
class t_TYPE>
10420template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
10422Optional_Base<t_TYPE, false>::Optional_Base(
10424 std::initializer_list<t_INIT_LIST_TYPE> il,
10426: StdOptionalBase(
bsl::
in_place, il,
std::forward<t_ARGS>(args)...)
10430#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
10431template <
class t_TYPE>
10432template <
class t_INVOCABLE,
class t_ARG>
10434Optional_Base<t_TYPE, false>::Optional_Base(
10435 Optional_InvokeConstructorTag ,
10436 t_INVOCABLE&& invocable,
10438: StdOptionalBase(Optional_ImmovableHelper<t_TYPE, t_INVOCABLE, t_ARG>{
10439 std::forward<t_INVOCABLE>(invocable),
10440 std::forward<t_ARG>(arg)})
10445template <
class t_TYPE>
10450 "Should not be called for non-allocator-aware types");
10453template <
class t_TYPE>
10460 "Should not be called for non-allocator-aware types");
10463template <
class t_TYPE>
10464template <
class t_ANY_TYPE>
10466Optional_Base<t_TYPE, false>::Optional_Base(
10469 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
10473 "Should not be called for non-allocator-aware types");
10476template <
class t_TYPE>
10477template <
class t_ANY_TYPE>
10479Optional_Base<t_TYPE, false>::Optional_Base(
10482 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
10483 const Optional_Base<t_ANY_TYPE>&)
10486 "Should not be called for non-allocator-aware types");
10489template <
class t_TYPE>
10490template <
class t_ANY_TYPE>
10492Optional_Base<t_TYPE, false>::Optional_Base(
10495 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
10496 Optional_Base<t_ANY_TYPE>&&)
10499 "Should not be called for non-allocator-aware types");
10502template <
class t_TYPE>
10503template <
class t_ANY_TYPE>
10505Optional_Base<t_TYPE, false>::Optional_Base(
10508 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
10509 const std::optional<t_ANY_TYPE>&)
10512 "Should not be called for non-allocator-aware types");
10515template <
class t_TYPE>
10516template <
class t_ANY_TYPE>
10518Optional_Base<t_TYPE, false>::Optional_Base(
10521 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
10522 std::optional<t_ANY_TYPE>&&)
10525 "Should not be called for non-allocator-aware types");
10528template <
class t_TYPE>
10529template <
class... t_ARGS>
10537 "Should not be called for non-allocator-aware types");
10540template <
class t_TYPE>
10541template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
10543Optional_Base<t_TYPE, false>::Optional_Base(
10547 std::initializer_list<t_INIT_LIST_TYPE>,
10551 "Should not be called for non-allocator-aware types");
10555template <
class t_TYPE>
10556template <
class t_ANY_TYPE>
10558void Optional_Base<t_TYPE, false>::assignOrEmplace(t_ANY_TYPE&& rhs)
10560 StdOptionalBase::operator=(std::forward<t_ANY_TYPE>(rhs));
10563# ifndef BDE_OMIT_INTERNAL_DEPRECATED
10564template <
class t_TYPE>
10565t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw()
10575template <
class t_TYPE>
10576const t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw()
const
10593template <
class t_TYPE>
10595Optional_Base<t_TYPE, false>::Optional_Base()
10599template <
class t_TYPE>
10605template <
class t_TYPE>
10607Optional_Base<t_TYPE, false>::Optional_Base(
const Optional_Base& original)
10609 if (original.has_value()) {
10610 emplace(original.value());
10614template <
class t_TYPE>
10616Optional_Base<t_TYPE, false>::Optional_Base(
10617 BloombergLP::bslmf::MovableRef<Optional_Base> original)
10621 Optional_Base& lvalue = original;
10623 if (lvalue.has_value()) {
10624 emplace(MoveUtil::move(*lvalue));
10628template <
class t_TYPE>
10629template <
class t_ANY_TYPE>
10631Optional_Base<t_TYPE, false>::Optional_Base(
10632 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
10638template <
class t_TYPE>
10639template <
class t_ANY_TYPE>
10641Optional_Base<t_TYPE, false>::Optional_Base(
10642 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
10643 const Optional_Base<t_ANY_TYPE>& original)
10645 if (original.has_value()) {
10646 emplace(original.value());
10650template <
class t_TYPE>
10651template <
class t_ANY_TYPE>
10653Optional_Base<t_TYPE, false>::Optional_Base(
10654 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
10657 Optional_Base<t_ANY_TYPE>& lvalue = original;
10658 if (lvalue.has_value()) {
10659 emplace(MoveUtil::move(*lvalue));
10663#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
10666#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
10667#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
10669#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_P
10670#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_P BSLSTL_OPTIONAL_VARIADIC_LIMIT
10672#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0
10673template <
class t_TYPE>
10675Optional_Base<t_TYPE, false>::Optional_Base(
10682#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1
10683template <
class t_TYPE>
10684template <
class t_ARGS_01>
10686Optional_Base<t_TYPE, false>::Optional_Base(
10694#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2
10695template <
class t_TYPE>
10696template <
class t_ARGS_01,
10699Optional_Base<t_TYPE, false>::Optional_Base(
10709#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3
10710template <
class t_TYPE>
10711template <
class t_ARGS_01,
10715Optional_Base<t_TYPE, false>::Optional_Base(
10727#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4
10728template <
class t_TYPE>
10729template <
class t_ARGS_01,
10734Optional_Base<t_TYPE, false>::Optional_Base(
10748#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5
10749template <
class t_TYPE>
10750template <
class t_ARGS_01,
10756Optional_Base<t_TYPE, false>::Optional_Base(
10772#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6
10773template <
class t_TYPE>
10774template <
class t_ARGS_01,
10781Optional_Base<t_TYPE, false>::Optional_Base(
10799#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7
10800template <
class t_TYPE>
10801template <
class t_ARGS_01,
10809Optional_Base<t_TYPE, false>::Optional_Base(
10829#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8
10830template <
class t_TYPE>
10831template <
class t_ARGS_01,
10840Optional_Base<t_TYPE, false>::Optional_Base(
10862#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9
10863template <
class t_TYPE>
10864template <
class t_ARGS_01,
10874Optional_Base<t_TYPE, false>::Optional_Base(
10898#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10
10899template <
class t_TYPE>
10900template <
class t_ARGS_01,
10911Optional_Base<t_TYPE, false>::Optional_Base(
10938# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
10939#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0
10940template <
class t_TYPE>
10941template <
class t_INIT_LIST_TYPE>
10943Optional_Base<t_TYPE, false>::Optional_Base(
10945 std::initializer_list<t_INIT_LIST_TYPE> il)
10951#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1
10952template <
class t_TYPE>
10953template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
10955Optional_Base<t_TYPE, false>::Optional_Base(
10957 std::initializer_list<t_INIT_LIST_TYPE> il,
10964#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2
10965template <
class t_TYPE>
10966template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
10969Optional_Base<t_TYPE, false>::Optional_Base(
10971 std::initializer_list<t_INIT_LIST_TYPE> il,
10980#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3
10981template <
class t_TYPE>
10982template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
10986Optional_Base<t_TYPE, false>::Optional_Base(
10988 std::initializer_list<t_INIT_LIST_TYPE> il,
10999#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4
11000template <
class t_TYPE>
11001template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11006Optional_Base<t_TYPE, false>::Optional_Base(
11008 std::initializer_list<t_INIT_LIST_TYPE> il,
11021#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5
11022template <
class t_TYPE>
11023template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11029Optional_Base<t_TYPE, false>::Optional_Base(
11031 std::initializer_list<t_INIT_LIST_TYPE> il,
11046#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6
11047template <
class t_TYPE>
11048template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11055Optional_Base<t_TYPE, false>::Optional_Base(
11057 std::initializer_list<t_INIT_LIST_TYPE> il,
11074#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7
11075template <
class t_TYPE>
11076template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11084Optional_Base<t_TYPE, false>::Optional_Base(
11086 std::initializer_list<t_INIT_LIST_TYPE> il,
11105#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8
11106template <
class t_TYPE>
11107template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11116Optional_Base<t_TYPE, false>::Optional_Base(
11118 std::initializer_list<t_INIT_LIST_TYPE> il,
11139#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9
11140template <
class t_TYPE>
11141template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11151Optional_Base<t_TYPE, false>::Optional_Base(
11153 std::initializer_list<t_INIT_LIST_TYPE> il,
11176#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10
11177template <
class t_TYPE>
11178template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11189Optional_Base<t_TYPE, false>::Optional_Base(
11191 std::initializer_list<t_INIT_LIST_TYPE> il,
11220template <
class t_TYPE>
11221template <
class... t_ARGS>
11223Optional_Base<t_TYPE, false>::Optional_Base(
11230# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
11231template <
class t_TYPE>
11232template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
11234Optional_Base<t_TYPE, false>::Optional_Base(
11236 std::initializer_list<t_INIT_LIST_TYPE> il,
11245template <
class t_TYPE>
11250 "Should not be called for non-allocator-aware types");
11253template <
class t_TYPE>
11260 "Should not be called for non-allocator-aware types");
11263template <
class t_TYPE>
11267 const Optional_Base&)
11270 "Should not be called for non-allocator-aware types");
11273template <
class t_TYPE>
11275Optional_Base<t_TYPE, false>::Optional_Base(
11278 BloombergLP::bslmf::MovableRef<Optional_Base>)
11281 "Should not be called for non-allocator-aware types");
11284template <
class t_TYPE>
11285template <
class t_ANY_TYPE>
11287Optional_Base<t_TYPE, false>::Optional_Base(
11290 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
11294 "Should not be called for non-allocator-aware types");
11297template <
class t_TYPE>
11298template <
class t_ANY_TYPE>
11300Optional_Base<t_TYPE, false>::Optional_Base(
11303 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
11304 const Optional_Base<t_ANY_TYPE>&)
11307 "Should not be called for non-allocator-aware types");
11310template <
class t_TYPE>
11311template <
class t_ANY_TYPE>
11313Optional_Base<t_TYPE, false>::Optional_Base(
11316 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
11320 "Should not be called for non-allocator-aware types");
11323#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
11326#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
11327#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
11329#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q
11330#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q BSLSTL_OPTIONAL_VARIADIC_LIMIT
11332#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0
11333template <
class t_TYPE>
11335Optional_Base<t_TYPE, false>::Optional_Base(
11341 "Should not be called for non-allocator-aware types");
11345#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1
11346template <
class t_TYPE>
11347template <
class t_ARGS_01>
11349Optional_Base<t_TYPE, false>::Optional_Base(
11356 "Should not be called for non-allocator-aware types");
11360#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2
11361template <
class t_TYPE>
11362template <
class t_ARGS_01,
11365Optional_Base<t_TYPE, false>::Optional_Base(
11373 "Should not be called for non-allocator-aware types");
11377#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3
11378template <
class t_TYPE>
11379template <
class t_ARGS_01,
11383Optional_Base<t_TYPE, false>::Optional_Base(
11392 "Should not be called for non-allocator-aware types");
11396#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4
11397template <
class t_TYPE>
11398template <
class t_ARGS_01,
11403Optional_Base<t_TYPE, false>::Optional_Base(
11413 "Should not be called for non-allocator-aware types");
11417#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5
11418template <
class t_TYPE>
11419template <
class t_ARGS_01,
11425Optional_Base<t_TYPE, false>::Optional_Base(
11436 "Should not be called for non-allocator-aware types");
11440#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6
11441template <
class t_TYPE>
11442template <
class t_ARGS_01,
11449Optional_Base<t_TYPE, false>::Optional_Base(
11461 "Should not be called for non-allocator-aware types");
11465#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7
11466template <
class t_TYPE>
11467template <
class t_ARGS_01,
11475Optional_Base<t_TYPE, false>::Optional_Base(
11488 "Should not be called for non-allocator-aware types");
11492#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8
11493template <
class t_TYPE>
11494template <
class t_ARGS_01,
11503Optional_Base<t_TYPE, false>::Optional_Base(
11517 "Should not be called for non-allocator-aware types");
11521#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9
11522template <
class t_TYPE>
11523template <
class t_ARGS_01,
11533Optional_Base<t_TYPE, false>::Optional_Base(
11548 "Should not be called for non-allocator-aware types");
11552#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10
11553template <
class t_TYPE>
11554template <
class t_ARGS_01,
11565Optional_Base<t_TYPE, false>::Optional_Base(
11581 "Should not be called for non-allocator-aware types");
11586# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
11587#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0
11588template <
class t_TYPE>
11589template <
class t_INIT_LIST_TYPE>
11591Optional_Base<t_TYPE, false>::Optional_Base(
11595 std::initializer_list<t_INIT_LIST_TYPE>)
11598 "Should not be called for non-allocator-aware types");
11602#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1
11603template <
class t_TYPE>
11604template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
11606Optional_Base<t_TYPE, false>::Optional_Base(
11610 std::initializer_list<t_INIT_LIST_TYPE>,
11614 "Should not be called for non-allocator-aware types");
11618#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2
11619template <
class t_TYPE>
11620template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11623Optional_Base<t_TYPE, false>::Optional_Base(
11627 std::initializer_list<t_INIT_LIST_TYPE>,
11632 "Should not be called for non-allocator-aware types");
11636#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3
11637template <
class t_TYPE>
11638template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11642Optional_Base<t_TYPE, false>::Optional_Base(
11646 std::initializer_list<t_INIT_LIST_TYPE>,
11652 "Should not be called for non-allocator-aware types");
11656#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4
11657template <
class t_TYPE>
11658template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11663Optional_Base<t_TYPE, false>::Optional_Base(
11667 std::initializer_list<t_INIT_LIST_TYPE>,
11674 "Should not be called for non-allocator-aware types");
11678#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5
11679template <
class t_TYPE>
11680template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11686Optional_Base<t_TYPE, false>::Optional_Base(
11690 std::initializer_list<t_INIT_LIST_TYPE>,
11698 "Should not be called for non-allocator-aware types");
11702#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6
11703template <
class t_TYPE>
11704template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11711Optional_Base<t_TYPE, false>::Optional_Base(
11715 std::initializer_list<t_INIT_LIST_TYPE>,
11724 "Should not be called for non-allocator-aware types");
11728#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7
11729template <
class t_TYPE>
11730template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11738Optional_Base<t_TYPE, false>::Optional_Base(
11742 std::initializer_list<t_INIT_LIST_TYPE>,
11752 "Should not be called for non-allocator-aware types");
11756#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8
11757template <
class t_TYPE>
11758template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11767Optional_Base<t_TYPE, false>::Optional_Base(
11771 std::initializer_list<t_INIT_LIST_TYPE>,
11782 "Should not be called for non-allocator-aware types");
11786#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9
11787template <
class t_TYPE>
11788template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11798Optional_Base<t_TYPE, false>::Optional_Base(
11802 std::initializer_list<t_INIT_LIST_TYPE>,
11814 "Should not be called for non-allocator-aware types");
11818#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10
11819template <
class t_TYPE>
11820template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
11831Optional_Base<t_TYPE, false>::Optional_Base(
11835 std::initializer_list<t_INIT_LIST_TYPE>,
11848 "Should not be called for non-allocator-aware types");
11856template <
class t_TYPE>
11857template <
class... t_ARGS>
11859Optional_Base<t_TYPE, false>::Optional_Base(
11866 "Should not be called for non-allocator-aware types");
11869# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
11870template <
class t_TYPE>
11871template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
11873Optional_Base<t_TYPE, false>::Optional_Base(
11877 std::initializer_list<t_INIT_LIST_TYPE>,
11881 "Should not be called for non-allocator-aware types");
11888template <
class t_TYPE>
11889template <
class t_ANY_TYPE>
11890void Optional_Base<t_TYPE, false>::assignOrEmplace(
11900# ifndef BDE_OMIT_INTERNAL_DEPRECATED
11901template <
class t_TYPE>
11902t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw()
11907 return d_value.value();
11912template <
class t_TYPE>
11913const t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw()
const
11918 return d_value.value();
11924#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
11927#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
11928#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
11930#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_R
11931#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_R BSLSTL_OPTIONAL_VARIADIC_LIMIT
11933#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0
11934template <
class t_TYPE>
11937Optional_Base<t_TYPE, false>::emplace(
11940 return d_value.emplace(NULL);
11944#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1
11945template <
class t_TYPE>
11946template <
class t_ARGS_01>
11949Optional_Base<t_TYPE, false>::emplace(
11952 return d_value.emplace(NULL,
11957#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2
11958template <
class t_TYPE>
11959template <
class t_ARGS_01,
11963Optional_Base<t_TYPE, false>::emplace(
11967 return d_value.emplace(NULL,
11973#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3
11974template <
class t_TYPE>
11975template <
class t_ARGS_01,
11980Optional_Base<t_TYPE, false>::emplace(
11985 return d_value.emplace(NULL,
11992#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4
11993template <
class t_TYPE>
11994template <
class t_ARGS_01,
12000Optional_Base<t_TYPE, false>::emplace(
12006 return d_value.emplace(NULL,
12014#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5
12015template <
class t_TYPE>
12016template <
class t_ARGS_01,
12023Optional_Base<t_TYPE, false>::emplace(
12030 return d_value.emplace(NULL,
12039#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6
12040template <
class t_TYPE>
12041template <
class t_ARGS_01,
12049Optional_Base<t_TYPE, false>::emplace(
12057 return d_value.emplace(NULL,
12067#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7
12068template <
class t_TYPE>
12069template <
class t_ARGS_01,
12078Optional_Base<t_TYPE, false>::emplace(
12087 return d_value.emplace(NULL,
12098#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8
12099template <
class t_TYPE>
12100template <
class t_ARGS_01,
12110Optional_Base<t_TYPE, false>::emplace(
12120 return d_value.emplace(NULL,
12132#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9
12133template <
class t_TYPE>
12134template <
class t_ARGS_01,
12145Optional_Base<t_TYPE, false>::emplace(
12156 return d_value.emplace(NULL,
12169#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10
12170template <
class t_TYPE>
12171template <
class t_ARGS_01,
12183Optional_Base<t_TYPE, false>::emplace(
12195 return d_value.emplace(NULL,
12210# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
12211#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0
12212template <
class t_TYPE>
12213template <
class t_INIT_LIST_TYPE>
12214t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12215 std::initializer_list<t_INIT_LIST_TYPE> il)
12217 return d_value.emplace(
12222#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1
12223template <
class t_TYPE>
12224template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
12225t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12226 std::initializer_list<t_INIT_LIST_TYPE> il,
12229 return d_value.emplace(
12234#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2
12235template <
class t_TYPE>
12236template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12238t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12239 std::initializer_list<t_INIT_LIST_TYPE> il,
12243 return d_value.emplace(
12249#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3
12250template <
class t_TYPE>
12251template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12254t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12255 std::initializer_list<t_INIT_LIST_TYPE> il,
12260 return d_value.emplace(
12267#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4
12268template <
class t_TYPE>
12269template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12273t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12274 std::initializer_list<t_INIT_LIST_TYPE> il,
12280 return d_value.emplace(
12288#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5
12289template <
class t_TYPE>
12290template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12295t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12296 std::initializer_list<t_INIT_LIST_TYPE> il,
12303 return d_value.emplace(
12312#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6
12313template <
class t_TYPE>
12314template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12320t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12321 std::initializer_list<t_INIT_LIST_TYPE> il,
12329 return d_value.emplace(
12339#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7
12340template <
class t_TYPE>
12341template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12348t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12349 std::initializer_list<t_INIT_LIST_TYPE> il,
12358 return d_value.emplace(
12369#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8
12370template <
class t_TYPE>
12371template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12379t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12380 std::initializer_list<t_INIT_LIST_TYPE> il,
12390 return d_value.emplace(
12402#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9
12403template <
class t_TYPE>
12404template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12413t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12414 std::initializer_list<t_INIT_LIST_TYPE> il,
12425 return d_value.emplace(
12438#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10
12439template <
class t_TYPE>
12440template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
12450t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12451 std::initializer_list<t_INIT_LIST_TYPE> il,
12463 return d_value.emplace(
12481template <
class t_TYPE>
12482template <
class... t_ARGS>
12485Optional_Base<t_TYPE, false>::emplace(
12488 return d_value.emplace(NULL,
12492# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
12493template <
class t_TYPE>
12494template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
12495t_TYPE& Optional_Base<t_TYPE, false>::emplace(
12496 std::initializer_list<t_INIT_LIST_TYPE> il,
12499 return d_value.emplace(
12506template <
class t_TYPE>
12513template <
class t_TYPE>
12514void Optional_Base<t_TYPE, false>::swap(Optional_Base& other)
12517 bsl::is_nothrow_swappable<t_TYPE>::value)
12519 if (this->has_value() && other.has_value()) {
12520 BloombergLP::bslalg::SwapUtil::swap(
12524 else if (this->has_value()) {
12525 other.emplace(MoveUtil::move(d_value.value()));
12528 else if (other.has_value()) {
12529 this->emplace(MoveUtil::move(*other));
12534# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12535template <
class t_TYPE>
12537t_TYPE& Optional_Base<t_TYPE, false>::value() &
12542 return d_value.value();
12544template <
class t_TYPE>
12547Optional_Base<t_TYPE, false>::value() &&
12552 return std::move(d_value.value());
12556template <
class t_TYPE>
12558t_TYPE& Optional_Base<t_TYPE, false>::value()
12563 return d_value.value();
12568# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12569template <
class t_TYPE>
12570template <
class t_ANY_TYPE>
12573Optional_Base<t_TYPE, false>::value_or(t_ANY_TYPE&& value) &&
12576 return t_TYPE(std::move(d_value.value()));
12579 return t_TYPE(std::forward<t_ANY_TYPE>(value));
12584template <
class t_TYPE>
12586Optional_Base<t_TYPE, false>&
12587Optional_Base<t_TYPE, false>::operator=(
const Optional_Base& rhs)
12589 if (
rhs.has_value()) {
12590 if (this->has_value()) {
12591 d_value.value() = *
rhs;
12603template <
class t_TYPE>
12605Optional_Base<t_TYPE, false>&
12606Optional_Base<t_TYPE, false>::operator=(
12607 BloombergLP::bslmf::MovableRef<Optional_Base> rhs)
12609 Optional_Base& lvalue =
rhs;
12610 if (lvalue.has_value()) {
12611 if (this->has_value()) {
12612 d_value.value() = MoveUtil::move(*lvalue);
12615 emplace(MoveUtil::move(*lvalue));
12624# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12625template <
class t_TYPE>
12627t_TYPE& Optional_Base<t_TYPE, false>::operator*() &
12631 return d_value.value();
12634template <
class t_TYPE>
12636t_TYPE&& Optional_Base<t_TYPE, false>::operator*() &&
12640 return std::move(d_value.value());
12643template <
class t_TYPE>
12645t_TYPE& Optional_Base<t_TYPE, false>::operator*()
12649 return d_value.value();
12653template <
class t_TYPE>
12655t_TYPE *Optional_Base<t_TYPE, false>::operator->()
12664template <
class t_TYPE>
12668 return d_value.hasValue();
12671# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12672template <
class t_TYPE>
12675Optional_Base<t_TYPE, false>::value() const&
12680 return d_value.value();
12683template <
class t_TYPE>
12686Optional_Base<t_TYPE, false>::value() const&&
12691 return std::move(d_value.value());
12695template <
class t_TYPE>
12698Optional_Base<t_TYPE, false>::value()
const
12703 return d_value.value();
12708# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12710template <
class t_TYPE>
12711template <
class t_ANY_TYPE>
12714Optional_Base<t_TYPE, false>::value_or(
12719 return t_TYPE(d_value.value());
12728template <
class t_TYPE>
12729template <
class t_ANY_TYPE>
12732Optional_Base<t_TYPE, false>::value_or(
12737 return t_TYPE(d_value.value());
12747template <
class t_TYPE>
12749const t_TYPE *Optional_Base<t_TYPE, false>::operator->()
const
12756# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12757template <
class t_TYPE>
12759const t_TYPE& Optional_Base<t_TYPE, false>::operator*() const&
12763 return d_value.value();
12766template <
class t_TYPE>
12768const t_TYPE&& Optional_Base<t_TYPE, false>::operator*() const&&
12772 return std::move(d_value.value());
12776template <
class t_TYPE>
12778const t_TYPE& Optional_Base<t_TYPE, false>::operator*()
const
12782 return d_value.value();
12786#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
12787template <
class t_TYPE>
12790 return has_value();
12808#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
12810template <
class t_TYPE>
12811template <
class t_INVOCABLE,
class t_ARG>
12814 BloombergLP::bslstl::Optional_InvokeConstructorTag tag,
12815 t_INVOCABLE&& invocable,
12817: BaseType(tag,
std::forward<t_INVOCABLE>(invocable),
std::forward<t_ARG>(arg))
12823template <
class t_TYPE>
12829template <
class t_TYPE>
12836#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
12837template <
class t_TYPE>
12838template <
class t_DERIVED>
12839optional<t_TYPE>::optional(
12840 BloombergLP::bslmf::MovableRef<t_DERIVED> original,
12844: BaseType(MoveUtil::move(static_cast<BaseType&>(original)))
12849template <
class t_TYPE>
12850template <
class t_ANY_TYPE>
12855: BaseType(BloombergLP::
bslstl::Optional_ConstructFromForwardRef(),
12860template <
class t_TYPE>
12861template <
class t_ANY_TYPE>
12866: BaseType(BloombergLP::
bslstl::Optional_ConstructFromForwardRef(),
12871template <
class t_TYPE>
12872template <
class t_ANY_TYPE>
12874 const optional<t_ANY_TYPE>& original,
12876 const t_ANY_TYPE&),
12878 const t_ANY_TYPE&))
12879: BaseType(BloombergLP::
bslstl::Optional_CopyConstructFromOtherOptional(),
12884template <
class t_TYPE>
12885template <
class t_ANY_TYPE>
12887 const optional<t_ANY_TYPE>& original,
12889 const t_ANY_TYPE&),
12891: BaseType(BloombergLP::
bslstl::Optional_CopyConstructFromOtherOptional(),
12896template <
class t_TYPE>
12897template <
class t_ANY_TYPE>
12902: BaseType(BloombergLP::
bslstl::Optional_MoveConstructFromOtherOptional(),
12904 static_cast<BloombergLP::
bslstl::Optional_Base<t_ANY_TYPE>&>(
12909template <
class t_TYPE>
12910template <
class t_ANY_TYPE>
12915: BaseType(BloombergLP::
bslstl::Optional_MoveConstructFromOtherOptional(),
12917 static_cast<BloombergLP::
bslstl::Optional_Base<t_ANY_TYPE>&>(
12922#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
12923template <
class t_TYPE>
12924template <
class t_ANY_TYPE>
12926 const std::optional<t_ANY_TYPE>& original,
12928 const t_ANY_TYPE&),
12930: BaseType(BloombergLP::
bslstl::Optional_CopyConstructFromStdOptional(),
12935template <
class t_TYPE>
12936template <
class t_ANY_TYPE>
12938 const std::optional<t_ANY_TYPE>& original,
12940 const t_ANY_TYPE&),
12942: BaseType(BloombergLP::
bslstl::Optional_CopyConstructFromStdOptional(),
12947template <
class t_TYPE>
12948template <
class t_ANY_TYPE>
12950 std::optional<t_ANY_TYPE>&& original,
12953: BaseType(BloombergLP::
bslstl::Optional_MoveConstructFromStdOptional(),
12954 std::move(original))
12958template <
class t_TYPE>
12959template <
class t_ANY_TYPE>
12961 std::optional<t_ANY_TYPE>&& original,
12964: BaseType(BloombergLP::
bslstl::Optional_MoveConstructFromStdOptional(),
12965 std::move(original))
12970#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
12973#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
12974#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
12976#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_S
12977#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_S BSLSTL_OPTIONAL_VARIADIC_LIMIT
12979#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0
12980template <
class t_TYPE>
12988#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1
12989template <
class t_TYPE>
12990template <
class t_ARGS_01>
12999#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2
13000template <
class t_TYPE>
13001template <
class t_ARGS_01,
13013#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3
13014template <
class t_TYPE>
13015template <
class t_ARGS_01,
13030#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4
13031template <
class t_TYPE>
13032template <
class t_ARGS_01,
13050#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5
13051template <
class t_TYPE>
13052template <
class t_ARGS_01,
13073#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6
13074template <
class t_TYPE>
13075template <
class t_ARGS_01,
13099#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7
13100template <
class t_TYPE>
13101template <
class t_ARGS_01,
13128#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8
13129template <
class t_TYPE>
13130template <
class t_ARGS_01,
13160#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9
13161template <
class t_TYPE>
13162template <
class t_ARGS_01,
13195#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10
13196template <
class t_TYPE>
13197template <
class t_ARGS_01,
13233#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
13234#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0
13235template <
class t_TYPE>
13236template <
class t_INIT_LIST_TYPE>
13239 std::initializer_list<t_INIT_LIST_TYPE> il)
13245#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1
13246template <
class t_TYPE>
13247template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
13250 std::initializer_list<t_INIT_LIST_TYPE> il,
13257#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2
13258template <
class t_TYPE>
13259template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13263 std::initializer_list<t_INIT_LIST_TYPE> il,
13272#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3
13273template <
class t_TYPE>
13274template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13279 std::initializer_list<t_INIT_LIST_TYPE> il,
13290#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4
13291template <
class t_TYPE>
13292template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13298 std::initializer_list<t_INIT_LIST_TYPE> il,
13311#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5
13312template <
class t_TYPE>
13313template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13320 std::initializer_list<t_INIT_LIST_TYPE> il,
13335#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6
13336template <
class t_TYPE>
13337template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13345 std::initializer_list<t_INIT_LIST_TYPE> il,
13362#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7
13363template <
class t_TYPE>
13364template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13373 std::initializer_list<t_INIT_LIST_TYPE> il,
13392#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8
13393template <
class t_TYPE>
13394template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13404 std::initializer_list<t_INIT_LIST_TYPE> il,
13425#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9
13426template <
class t_TYPE>
13427template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13438 std::initializer_list<t_INIT_LIST_TYPE> il,
13461#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10
13462template <
class t_TYPE>
13463template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
13475 std::initializer_list<t_INIT_LIST_TYPE> il,
13504template <
class t_TYPE>
13505template <
class... t_ARGS>
13512#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
13513template <
class t_TYPE>
13514template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
13517 std::initializer_list<t_INIT_LIST_TYPE> il,
13526template <
class t_TYPE>
13528: BaseType(
bsl::allocator_arg, allocator)
13532template <
class t_TYPE>
13534 AllocType allocator,
13536: BaseType(
bsl::allocator_arg, allocator)
13540template <
class t_TYPE>
13542 AllocType allocator,
13543 const optional& original)
13544: BaseType(
bsl::allocator_arg, allocator, original)
13548template <
class t_TYPE>
13549template <
class t_DERIVED>
13551 AllocType allocator,
13555: BaseType(
bsl::allocator_arg_t(),
13557 MoveUtil::move(static_cast<BaseType&>(original)))
13564template <
class t_TYPE>
13565template <
class t_ANY_TYPE>
13566optional<t_TYPE>::optional(
13568 AllocType allocator,
13572: BaseType(
bsl::allocator_arg_t(),
13574 BloombergLP::
bslstl::Optional_ConstructFromForwardRef(),
13579template <
class t_TYPE>
13580template <
class t_ANY_TYPE>
13581optional<t_TYPE>::optional(
13583 AllocType allocator,
13587: BaseType(
bsl::allocator_arg_t(),
13589 BloombergLP::
bslstl::Optional_ConstructFromForwardRef(),
13594template <
class t_TYPE>
13595template <
class t_ANY_TYPE>
13596optional<t_TYPE>::optional(
13598 AllocType allocator,
13599 const optional<t_ANY_TYPE>& original,
13601 const t_ANY_TYPE&),
13603 const t_ANY_TYPE&))
13604: BaseType(
bsl::allocator_arg_t(),
13606 BloombergLP::
bslstl::Optional_CopyConstructFromOtherOptional(),
13611template <
class t_TYPE>
13612template <
class t_ANY_TYPE>
13613optional<t_TYPE>::optional(
13615 AllocType allocator,
13616 const optional<t_ANY_TYPE>& original,
13618 const t_ANY_TYPE&),
13620: BaseType(
bsl::allocator_arg_t(),
13622 BloombergLP::
bslstl::Optional_CopyConstructFromOtherOptional(),
13627template <
class t_TYPE>
13628template <
class t_ANY_TYPE>
13629optional<t_TYPE>::optional(
13631 AllocType allocator,
13635: BaseType(
bsl::allocator_arg_t(),
13637 BloombergLP::
bslstl::Optional_MoveConstructFromOtherOptional(),
13639 static_cast<BloombergLP::
bslstl::Optional_Base<t_ANY_TYPE>&>(
13644template <
class t_TYPE>
13645template <
class t_ANY_TYPE>
13646optional<t_TYPE>::optional(
13648 AllocType allocator,
13652: BaseType(
bsl::allocator_arg_t(),
13654 BloombergLP::
bslstl::Optional_MoveConstructFromOtherOptional(),
13656 static_cast<BloombergLP::
bslstl::Optional_Base<t_ANY_TYPE>&>(
13661#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
13662template <
class t_TYPE>
13663template <
class t_ANY_TYPE>
13664optional<t_TYPE>::optional(
13666 AllocType allocator,
13667 const std::optional<t_ANY_TYPE>& original,
13669 const t_ANY_TYPE&),
13671 const t_ANY_TYPE&))
13672: BaseType(
bsl::allocator_arg_t(),
13674 BloombergLP::
bslstl::Optional_CopyConstructFromStdOptional(),
13679template <
class t_TYPE>
13680template <
class t_ANY_TYPE>
13681optional<t_TYPE>::optional(
13683 AllocType allocator,
13684 const std::optional<t_ANY_TYPE>& original,
13686 const t_ANY_TYPE&),
13688: BaseType(
bsl::allocator_arg_t(),
13690 BloombergLP::
bslstl::Optional_CopyConstructFromStdOptional(),
13695template <
class t_TYPE>
13696template <
class t_ANY_TYPE>
13697optional<t_TYPE>::optional(
13699 AllocType allocator,
13700 std::optional<t_ANY_TYPE>&& original,
13703: BaseType(
bsl::allocator_arg_t(),
13705 BloombergLP::
bslstl::Optional_MoveConstructFromStdOptional(),
13706 std::move(original))
13710template <
class t_TYPE>
13711template <
class t_ANY_TYPE>
13712optional<t_TYPE>::optional(
13714 AllocType allocator,
13715 std::optional<t_ANY_TYPE>&& original,
13718: BaseType(
bsl::allocator_arg_t(),
13720 BloombergLP::
bslstl::Optional_MoveConstructFromStdOptional(),
13721 std::move(original))
13726#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
13729#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
13730#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
13732#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_T
13733#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_T BSLSTL_OPTIONAL_VARIADIC_LIMIT
13735#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0
13736template <
class t_TYPE>
13737optional<t_TYPE>::optional(
13739 AllocType allocator,
13741: BaseType(
bsl::allocator_arg,
13748#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1
13749template <
class t_TYPE>
13750template <
class t_ARGS_01>
13751optional<t_TYPE>::optional(
13753 AllocType allocator,
13756: BaseType(
bsl::allocator_arg,
13764#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2
13765template <
class t_TYPE>
13766template <
class t_ARGS_01,
13768optional<t_TYPE>::optional(
13770 AllocType allocator,
13774: BaseType(
bsl::allocator_arg,
13783#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3
13784template <
class t_TYPE>
13785template <
class t_ARGS_01,
13788optional<t_TYPE>::optional(
13790 AllocType allocator,
13795: BaseType(
bsl::allocator_arg,
13805#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4
13806template <
class t_TYPE>
13807template <
class t_ARGS_01,
13811optional<t_TYPE>::optional(
13813 AllocType allocator,
13819: BaseType(
bsl::allocator_arg,
13830#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5
13831template <
class t_TYPE>
13832template <
class t_ARGS_01,
13837optional<t_TYPE>::optional(
13839 AllocType allocator,
13846: BaseType(
bsl::allocator_arg,
13858#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6
13859template <
class t_TYPE>
13860template <
class t_ARGS_01,
13866optional<t_TYPE>::optional(
13868 AllocType allocator,
13876: BaseType(
bsl::allocator_arg,
13889#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7
13890template <
class t_TYPE>
13891template <
class t_ARGS_01,
13898optional<t_TYPE>::optional(
13900 AllocType allocator,
13909: BaseType(
bsl::allocator_arg,
13923#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8
13924template <
class t_TYPE>
13925template <
class t_ARGS_01,
13933optional<t_TYPE>::optional(
13935 AllocType allocator,
13945: BaseType(
bsl::allocator_arg,
13960#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9
13961template <
class t_TYPE>
13962template <
class t_ARGS_01,
13971optional<t_TYPE>::optional(
13973 AllocType allocator,
13984: BaseType(
bsl::allocator_arg,
14000#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10
14001template <
class t_TYPE>
14002template <
class t_ARGS_01,
14012optional<t_TYPE>::optional(
14014 AllocType allocator,
14026: BaseType(
bsl::allocator_arg,
14043#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
14044#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0
14045template <
class t_TYPE>
14046template <
class t_INIT_LIST_TYPE>
14047optional<t_TYPE>::optional(
14049 AllocType allocator,
14051 std::initializer_list<t_INIT_LIST_TYPE> il)
14052: BaseType(
bsl::allocator_arg,
14060#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1
14061template <
class t_TYPE>
14062template <
class t_INIT_LIST_TYPE,
class t_ARGS_01>
14063optional<t_TYPE>::optional(
14065 AllocType allocator,
14067 std::initializer_list<t_INIT_LIST_TYPE> il,
14069: BaseType(
bsl::allocator_arg,
14078#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2
14079template <
class t_TYPE>
14080template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14082optional<t_TYPE>::optional(
14084 AllocType allocator,
14086 std::initializer_list<t_INIT_LIST_TYPE> il,
14089: BaseType(
bsl::allocator_arg,
14099#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3
14100template <
class t_TYPE>
14101template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14104optional<t_TYPE>::optional(
14106 AllocType allocator,
14108 std::initializer_list<t_INIT_LIST_TYPE> il,
14112: BaseType(
bsl::allocator_arg,
14123#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4
14124template <
class t_TYPE>
14125template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14129optional<t_TYPE>::optional(
14131 AllocType allocator,
14133 std::initializer_list<t_INIT_LIST_TYPE> il,
14138: BaseType(
bsl::allocator_arg,
14150#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5
14151template <
class t_TYPE>
14152template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14157optional<t_TYPE>::optional(
14159 AllocType allocator,
14161 std::initializer_list<t_INIT_LIST_TYPE> il,
14167: BaseType(
bsl::allocator_arg,
14180#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6
14181template <
class t_TYPE>
14182template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14188optional<t_TYPE>::optional(
14190 AllocType allocator,
14192 std::initializer_list<t_INIT_LIST_TYPE> il,
14199: BaseType(
bsl::allocator_arg,
14213#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7
14214template <
class t_TYPE>
14215template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14222optional<t_TYPE>::optional(
14224 AllocType allocator,
14226 std::initializer_list<t_INIT_LIST_TYPE> il,
14234: BaseType(
bsl::allocator_arg,
14249#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8
14250template <
class t_TYPE>
14251template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14259optional<t_TYPE>::optional(
14261 AllocType allocator,
14263 std::initializer_list<t_INIT_LIST_TYPE> il,
14272: BaseType(
bsl::allocator_arg,
14288#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9
14289template <
class t_TYPE>
14290template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14299optional<t_TYPE>::optional(
14301 AllocType allocator,
14303 std::initializer_list<t_INIT_LIST_TYPE> il,
14313: BaseType(
bsl::allocator_arg,
14330#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10
14331template <
class t_TYPE>
14332template <
class t_INIT_LIST_TYPE,
class t_ARGS_01,
14342optional<t_TYPE>::optional(
14344 AllocType allocator,
14346 std::initializer_list<t_INIT_LIST_TYPE> il,
14357: BaseType(
bsl::allocator_arg,
14379template <
class t_TYPE>
14380template <
class... t_ARGS>
14381optional<t_TYPE>::optional(
14383 AllocType allocator,
14386: BaseType(
bsl::allocator_arg,
14392#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
14393template <
class t_TYPE>
14394template <
class t_INIT_LIST_TYPE,
class... t_ARGS>
14395optional<t_TYPE>::optional(
14397 AllocType allocator,
14399 std::initializer_list<t_INIT_LIST_TYPE> il,
14401: BaseType(
bsl::allocator_arg,
14413template <
class t_TYPE>
14421#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
14422template <
class t_TYPE>
14423template <
class t_DERIVED>
14425optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_DERIVED> rhs)
14427 BaseType& lvalue =
rhs;
14428 BaseType::operator=(MoveUtil::move(lvalue));
14433template <
class t_TYPE>
14434template <
class t_ANY_TYPE>
14437optional<t_TYPE>::operator=(
const optional<t_ANY_TYPE>& rhs)
14439 if (
rhs.has_value()) {
14440 this->assignOrEmplace(*rhs);
14447template <
class t_TYPE>
14448template <
class t_ANY_TYPE>
14453 BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>& lvalue =
rhs;
14454 if (lvalue.has_value()) {
14455 this->assignOrEmplace(MoveUtil::move(*lvalue));
14462#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
14463template <
class t_TYPE>
14464template <
class t_ANY_TYPE>
14467optional<t_TYPE>::operator=(t_ANY_TYPE&& rhs)
14469 this->assignOrEmplace(std::forward<t_ANY_TYPE>(rhs));
14473template <
class t_TYPE>
14474optional<t_TYPE>& optional<t_TYPE>::operator=(
const t_TYPE& rhs)
14476 this->assignOrEmplace(rhs);
14480template <
class t_TYPE>
14482optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_TYPE> rhs)
14484 this->assignOrEmplace(MoveUtil::move(rhs));
14488template <
class t_TYPE>
14489template <
class t_ANY_TYPE>
14491optional<t_TYPE>::operator=(
const t_ANY_TYPE& rhs)
14493 this->assignOrEmplace(rhs);
14497template <
class t_TYPE>
14498template <
class t_ANY_TYPE>
14500optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_ANY_TYPE> rhs)
14502 this->assignOrEmplace(MoveUtil::move(rhs));
14507#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
14508template <
class t_TYPE>
14509template <
class t_ANY_TYPE>
14512optional<t_TYPE>::operator=(
const std::optional<t_ANY_TYPE>& rhs)
14514 if (
rhs.has_value()) {
14515 this->assignOrEmplace(*rhs);
14522template <
class t_TYPE>
14523template <
class t_ANY_TYPE>
14526optional<t_TYPE>::operator=(std::optional<t_ANY_TYPE>&& rhs)
14528 if (
rhs.has_value()) {
14529 this->assignOrEmplace(std::move(*rhs));
14537#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
14538template <
class t_TYPE>
14539template <
class t_FUNC>
14540constexpr auto optional<t_TYPE>::transform(t_FUNC&& func) &
14542 using ResultType = std::remove_cv_t<std::invoke_result_t<t_FUNC, t_TYPE&>>;
14543 static_assert(!std::is_array_v<ResultType>,
14544 "The callable must return an array");
14545 static_assert(!std::is_same_v<ResultType, nullopt_t>,
14546 "The callable must not return nullopt_t");
14547 static_assert(!std::is_same_v<ResultType, in_place_t>,
14548 "The callable must not return in_place_t");
14549 static_assert(std::is_object_v<ResultType>,
14550 "The callable must return an object type");
14552 if (this->has_value()) {
14553 using BloombergLP::bslstl::Optional_InvokeConstructorTag;
14554 return optional<ResultType>{Optional_InvokeConstructorTag{},
14555 std::forward<t_FUNC>(func),
14558 return optional<ResultType>{};
14561template <
class t_TYPE>
14562template <
class t_FUNC>
14563constexpr auto optional<t_TYPE>::transform(t_FUNC&& func)
const &
14566 std::remove_cv_t<std::invoke_result_t<t_FUNC, const t_TYPE&>>;
14567 static_assert(!std::is_array_v<ResultType>,
14568 "The callable must return an array");
14569 static_assert(!std::is_same_v<ResultType, nullopt_t>,
14570 "The callable must not return nullopt_t");
14571 static_assert(!std::is_same_v<ResultType, in_place_t>,
14572 "The callable must not return in_place_t");
14573 static_assert(std::is_object_v<ResultType>,
14574 "The callable must return an object type");
14576 if (this->has_value()) {
14577 using BloombergLP::bslstl::Optional_InvokeConstructorTag;
14578 return optional<ResultType>{Optional_InvokeConstructorTag{},
14579 std::forward<t_FUNC>(func),
14582 return optional<ResultType>{};
14585template <
class t_TYPE>
14586template <
class t_FUNC>
14587constexpr auto optional<t_TYPE>::transform(t_FUNC&& func) &&
14590 std::remove_cv_t<std::invoke_result_t<t_FUNC, t_TYPE&&>>;
14591 static_assert(!std::is_array_v<ResultType>,
14592 "The callable must return an array");
14593 static_assert(!std::is_same_v<ResultType, nullopt_t>,
14594 "The callable must not return nullopt_t");
14595 static_assert(!std::is_same_v<ResultType, in_place_t>,
14596 "The callable must not return in_place_t");
14597 static_assert(std::is_object_v<ResultType>,
14598 "The callable must return an object type");
14600 if (this->has_value()) {
14601 using BloombergLP::bslstl::Optional_InvokeConstructorTag;
14602 return optional<ResultType>{Optional_InvokeConstructorTag{},
14603 std::forward<t_FUNC>(func),
14604 std::move(**
this)};
14606 return optional<ResultType>{};
14609template <
class t_TYPE>
14610template <
class t_FUNC>
14611constexpr auto optional<t_TYPE>::transform(t_FUNC&& func)
const &&
14614 std::remove_cv_t<std::invoke_result_t<t_FUNC, const t_TYPE&&>>;
14615 static_assert(!std::is_array_v<ResultType>,
14616 "The callable must return an array");
14617 static_assert(!std::is_same_v<ResultType, nullopt_t>,
14618 "The callable must not return nullopt_t");
14619 static_assert(!std::is_same_v<ResultType, in_place_t>,
14620 "The callable must not return in_place_t");
14621 static_assert(std::is_object_v<ResultType>,
14622 "The callable must return an object type");
14624 if (this->has_value()) {
14625 using BloombergLP::bslstl::Optional_InvokeConstructorTag;
14626 return optional<ResultType>{Optional_InvokeConstructorTag{},
14627 std::forward<t_FUNC>(func),
14628 std::move(**
this)};
14630 return optional<ResultType>{};
14633template <
class t_TYPE>
14634template <
class t_FUNC>
14635constexpr auto optional<t_TYPE>::and_then(t_FUNC&& func) &
14637 using ResultType = std::remove_cv_t<std::remove_reference_t<
14638 std::invoke_result_t<t_FUNC, t_TYPE&>>>;
14639 using ::BloombergLP::bslstl::Optional_IsBslOptional;
14640 static_assert(Optional_IsBslOptional<ResultType>::value,
14641 "The callable must return bsl::optional");
14643 if (this->has_value()) {
14644 return std::invoke(std::forward<t_FUNC>(func), **
this);
14646 return ResultType{};
14649template <
class t_TYPE>
14650template <
class t_FUNC>
14651constexpr auto optional<t_TYPE>::and_then(t_FUNC&& func)
const &
14653 using ResultType = std::remove_cv_t<std::remove_reference_t<
14654 std::invoke_result_t<t_FUNC, const t_TYPE&>>>;
14655 using ::BloombergLP::bslstl::Optional_IsBslOptional;
14656 static_assert(Optional_IsBslOptional<ResultType>::value,
14657 "The callable must return bsl::optional");
14659 if (this->has_value()) {
14660 return std::invoke(std::forward<t_FUNC>(func), **
this);
14662 return ResultType{};
14665template <
class t_TYPE>
14666template <
class t_FUNC>
14667constexpr auto optional<t_TYPE>::and_then(t_FUNC&& func) &&
14669 using ResultType = std::remove_cv_t<std::remove_reference_t<
14670 std::invoke_result_t<t_FUNC, t_TYPE&&>>>;
14671 using ::BloombergLP::bslstl::Optional_IsBslOptional;
14672 static_assert(Optional_IsBslOptional<ResultType>::value,
14673 "The callable must return bsl::optional");
14675 if (this->has_value()) {
14676 return std::invoke(std::forward<t_FUNC>(func), std::move(**
this));
14678 return ResultType{};
14681template <
class t_TYPE>
14682template <
class t_FUNC>
14683constexpr auto optional<t_TYPE>::and_then(t_FUNC&& func)
const &&
14685 using ResultType = std::remove_cv_t<std::remove_reference_t<
14686 std::invoke_result_t<t_FUNC, const t_TYPE&&>>>;
14687 using ::BloombergLP::bslstl::Optional_IsBslOptional;
14688 static_assert(Optional_IsBslOptional<ResultType>::value,
14689 "The callable must return bsl::optional");
14691 if (this->has_value()) {
14692 return std::invoke(std::forward<t_FUNC>(func), std::move(**
this));
14694 return ResultType{};
14697template <
class t_TYPE>
14698template <
class t_FUNC>
14700enable_if_t<conjunction_v<std::is_invocable<t_FUNC>,
14701 std::is_copy_constructible<t_TYPE>>,
14702 optional<t_TYPE>> optional<t_TYPE>::or_else(t_FUNC&& func)
const &
14704 static_assert(std::is_same_v<remove_cvref_t<std::invoke_result_t<t_FUNC>>,
14706 "The callable must return bsl::optional<T>");
14708 if (this->has_value()) {
14711 return std::forward<t_FUNC>(func)();
14714template <
class t_TYPE>
14715template <
class t_FUNC>
14717enable_if_t<conjunction_v<std::is_invocable<t_FUNC>,
14718 std::is_move_constructible<t_TYPE>>,
14719 optional<t_TYPE>> optional<t_TYPE>::or_else(t_FUNC&& func) &&
14721 static_assert(std::is_same_v<remove_cvref_t<std::invoke_result_t<t_FUNC>>,
14723 "The callable must return bsl::optional<T>");
14725 if (this->has_value()) {
14726 return std::move(*
this);
14728 return std::forward<t_FUNC>(func)();
14736template <
class t_TYPE>
14742 if (
lhs.get_allocator() ==
rhs.get_allocator()) {
14749 bsl::allocator_arg,
lhs.get_allocator(), rhs);
14751 bsl::allocator_arg,
rhs.get_allocator(), lhs);
14753 futureLhs.swap(lhs);
14754 futureRhs.swap(rhs);
14757template <
class t_TYPE>
14767template <
class t_HASHALG,
class t_TYPE>
14770 using ::BloombergLP::bslh::hashAppend;
14772 if (input.has_value()) {
14783template <
class t_LHS_TYPE,
class t_RHS_TYPE>
14788 { *
lhs == *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14791 if (
lhs.has_value() &&
rhs.has_value()) {
14794 return lhs.has_value() ==
rhs.has_value();
14797template <
class t_LHS_TYPE,
class t_RHS_TYPE>
14802 { *
lhs != *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14805 if (
lhs.has_value() &&
rhs.has_value()) {
14809 return lhs.has_value() !=
rhs.has_value();
14812template <
class t_LHS_TYPE,
class t_RHS_TYPE>
14817 { *
lhs < *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14820 if (!
rhs.has_value()) {
14824 return !
lhs.has_value() || *
lhs < *
rhs;
14827template <
class t_LHS_TYPE,
class t_RHS_TYPE>
14832 { *
lhs > *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14835 if (!
lhs.has_value()) {
14839 return !
rhs.has_value() || *
lhs > *
rhs;
14842template <
class t_LHS_TYPE,
class t_RHS_TYPE>
14847 { *
lhs <= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14850 if (!
lhs.has_value()) {
14854 return rhs.has_value() && *
lhs <= *
rhs;
14857template <
class t_LHS_TYPE,
class t_RHS_TYPE>
14862 { *
lhs >= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14865 if (!
rhs.has_value()) {
14868 return lhs.has_value() && *
lhs >= *
rhs;
14873template <
class t_TYPE>
14879 return !value.has_value();
14882#if !(defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) && \
14883 defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS))
14884template <
class t_TYPE>
14890 return !value.has_value();
14893template <
class t_TYPE>
14899 return value.has_value();
14902template <
class t_TYPE>
14908 return value.has_value();
14911template <
class t_TYPE>
14920template <
class t_TYPE>
14926 return value.has_value();
14929template <
class t_TYPE>
14935 return value.has_value();
14938template <
class t_TYPE>
14947template <
class t_TYPE>
14953 return !value.has_value();
14956template <
class t_TYPE>
14965template <
class t_TYPE>
14974template <
class t_TYPE>
14980 return !value.has_value();
14987template <
class t_LHS_TYPE,
class t_RHS_TYPE>
14991 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
14993 { *
lhs ==
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14999template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15003 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
15005 {
lhs == *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15011template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15015 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
15017 { *
lhs !=
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15020 return !
lhs.has_value() || *
lhs !=
rhs;
15023template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15027 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
15029 {
lhs != *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15032 return !
rhs.has_value() ||
lhs != *
rhs;
15035template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15039 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
15041 { *
lhs <
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15047template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15051 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
15053 {
lhs < *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15059template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15063 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
15065 { *
lhs >
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15071template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15075 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
15077 {
lhs > *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15083template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15087 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
15089 { *
lhs <=
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15092 return !
lhs.has_value() || *
lhs <=
rhs;
15095template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15099 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
15101 {
lhs <= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15107template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15111 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
15113 { *
lhs >=
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15119template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15123 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
15125 {
lhs >= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15128 return !
rhs.has_value() ||
lhs >= *
rhs;
15131#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
15132 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
15133template <
class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
15135compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
15139 const bool lhs_has_value =
lhs.has_value(),
15140 rhs_has_value =
rhs.has_value();
15141 if (lhs_has_value && rhs_has_value) {
15142 return *lhs <=> *
rhs;
15144 return lhs_has_value <=> rhs_has_value;
15147template <
class t_LHS,
class t_RHS>
15148requires (!BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS>) &&
15149 three_way_comparable_with<t_LHS, t_RHS>
15151compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
15156 return *lhs <=>
rhs;
15158 return strong_ordering::less;
15161template <
class t_TYPE>
15166 return value.has_value() <=>
false;
15169template <
class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
15171compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
15173 const std::optional<t_RHS>& rhs)
15175 const bool lhs_has_value =
lhs.has_value(),
15176 rhs_has_value =
rhs.has_value();
15177 if (lhs_has_value && rhs_has_value) {
15178 return *lhs <=> *
rhs;
15180 return lhs_has_value <=> rhs_has_value;
15185# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
15186template <
class t_TYPE>
15195template <
class t_TYPE>
15206template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15209 const std::optional<t_RHS_TYPE>& rhs)
15211 { *
lhs == *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15214 if (
lhs.has_value() &&
rhs.has_value()) {
15217 return lhs.has_value() ==
rhs.has_value();
15220template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15222bool operator==(
const std::optional<t_LHS_TYPE>& lhs,
15225 { *
lhs == *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15228 if (
lhs.has_value() &&
rhs.has_value()) {
15231 return lhs.has_value() ==
rhs.has_value();
15234template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15237 const std::optional<t_RHS_TYPE>& rhs)
15239 { *
lhs != *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15242 if (
lhs.has_value() &&
rhs.has_value()) {
15246 return lhs.has_value() !=
rhs.has_value();
15249template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15251bool operator!=(
const std::optional<t_LHS_TYPE>& lhs,
15254 { *
lhs != *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15257 if (
lhs.has_value() &&
rhs.has_value()) {
15261 return lhs.has_value() !=
rhs.has_value();
15264template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15267 const std::optional<t_RHS_TYPE>& rhs)
15269 { *
lhs < *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15272 if (!
rhs.has_value()) {
15276 return !
lhs.has_value() || *
lhs < *
rhs;
15279template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15281bool operator<(
const std::optional<t_LHS_TYPE>& lhs,
15284 { *
lhs < *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15287 if (!
rhs.has_value()) {
15291 return !
lhs.has_value() || *
lhs < *
rhs;
15294template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15297 const std::optional<t_RHS_TYPE>& rhs)
15299 { *
lhs > *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15302 if (!
lhs.has_value()) {
15306 return !
rhs.has_value() || *
lhs > *
rhs;
15309template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15311bool operator>(
const std::optional<t_LHS_TYPE>& lhs,
15314 { *
lhs > *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15317 if (!
lhs.has_value()) {
15321 return !
rhs.has_value() || *
lhs > *
rhs;
15324template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15327 const std::optional<t_RHS_TYPE>& rhs)
15329 { *
lhs <= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15332 if (!
lhs.has_value()) {
15336 return rhs.has_value() && *
lhs <= *
rhs;
15339template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15341bool operator<=(
const std::optional<t_LHS_TYPE>& lhs,
15344 { *
lhs <= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15347 if (!
lhs.has_value()) {
15351 return rhs.has_value() && *
lhs <= *
rhs;
15354template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15357 const std::optional<t_RHS_TYPE>& rhs)
15359 { *
lhs >= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15362 if (!
rhs.has_value()) {
15365 return lhs.has_value() && *
lhs >= *
rhs;
15368template <
class t_LHS_TYPE,
class t_RHS_TYPE>
15370bool operator>=(
const std::optional<t_LHS_TYPE>& lhs,
15373 { *
lhs >= *
rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
15376 if (!
rhs.has_value()) {
15379 return lhs.has_value() && *
lhs >= *
rhs;
15383template <
class t_TYPE>
15391 bsl::allocator_arg,
15397#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
15400#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
15401#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
15403#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_U
15404#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_U BSLSTL_OPTIONAL_VARIADIC_LIMIT
15406#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 0
15407template <
class t_TYPE>
15413 bsl::allocator_arg,
15419#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 1
15420template <
class t_TYPE,
class t_ARGS_01>
15427 bsl::allocator_arg,
15434#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 2
15435template <
class t_TYPE,
class t_ARGS_01,
15444 bsl::allocator_arg,
15452#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 3
15453template <
class t_TYPE,
class t_ARGS_01,
15464 bsl::allocator_arg,
15473#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 4
15474template <
class t_TYPE,
class t_ARGS_01,
15487 bsl::allocator_arg,
15497#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 5
15498template <
class t_TYPE,
class t_ARGS_01,
15513 bsl::allocator_arg,
15524#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 6
15525template <
class t_TYPE,
class t_ARGS_01,
15542 bsl::allocator_arg,
15554#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 7
15555template <
class t_TYPE,
class t_ARGS_01,
15574 bsl::allocator_arg,
15587#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 8
15588template <
class t_TYPE,
class t_ARGS_01,
15609 bsl::allocator_arg,
15623#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 9
15624template <
class t_TYPE,
class t_ARGS_01,
15647 bsl::allocator_arg,
15662#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 10
15663template <
class t_TYPE,
class t_ARGS_01,
15688 bsl::allocator_arg,
15707template <
class t_TYPE,
class... t_ARGS>
15714 bsl::allocator_arg,
15722#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
15725#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
15726#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
15728#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_V
15729#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_V BSLSTL_OPTIONAL_VARIADIC_LIMIT
15731# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
15732#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 0
15733template <
class t_TYPE,
class t_INIT_LIST_TYPE>
15737 std::initializer_list<t_INIT_LIST_TYPE> il)
15740 bsl::allocator_arg,
15747#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 1
15748template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01>
15752 std::initializer_list<t_INIT_LIST_TYPE> il,
15756 bsl::allocator_arg,
15764#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 2
15765template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
15770 std::initializer_list<t_INIT_LIST_TYPE> il,
15775 bsl::allocator_arg,
15784#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 3
15785template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
15791 std::initializer_list<t_INIT_LIST_TYPE> il,
15797 bsl::allocator_arg,
15807#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 4
15808template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
15815 std::initializer_list<t_INIT_LIST_TYPE> il,
15822 bsl::allocator_arg,
15833#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 5
15834template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
15842 std::initializer_list<t_INIT_LIST_TYPE> il,
15850 bsl::allocator_arg,
15862#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 6
15863template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
15872 std::initializer_list<t_INIT_LIST_TYPE> il,
15881 bsl::allocator_arg,
15894#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 7
15895template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
15905 std::initializer_list<t_INIT_LIST_TYPE> il,
15915 bsl::allocator_arg,
15929#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 8
15930template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
15941 std::initializer_list<t_INIT_LIST_TYPE> il,
15952 bsl::allocator_arg,
15967#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 9
15968template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
15980 std::initializer_list<t_INIT_LIST_TYPE> il,
15992 bsl::allocator_arg,
16008#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 10
16009template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16022 std::initializer_list<t_INIT_LIST_TYPE> il,
16035 bsl::allocator_arg,
16056# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
16057template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class... t_ARGS>
16061 std::initializer_list<t_INIT_LIST_TYPE> il,
16065 bsl::allocator_arg,
16075template <
class t_TYPE>
16083template <
class t_TYPE>
16089#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
16092#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
16093#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
16095#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_W
16096#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_W BSLSTL_OPTIONAL_VARIADIC_LIMIT
16098#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0
16099template <
class t_TYPE,
class t_ARG>
16109#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1
16110template <
class t_TYPE,
class t_ARG,
class t_ARGS_01>
16122#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2
16123template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16138#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3
16139template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16157#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4
16158template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16179#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5
16180template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16204#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6
16205template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16232#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7
16233template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16263#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8
16264template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16297#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9
16298template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16334#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10
16335template <
class t_TYPE,
class t_ARG,
class t_ARGS_01,
16375# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
16376#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0
16377template <
class t_TYPE,
class t_INIT_LIST_TYPE>
16387#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1
16388template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01>
16400#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2
16401template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16416#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3
16417template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16435#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4
16436template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16457#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5
16458template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16482#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6
16483template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16510#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7
16511template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16541#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8
16542template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16575#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9
16576template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16612#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10
16613template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class t_ARGS_01,
16656template <
class t_TYPE,
class t_ARG,
class... t_ARGS>
16667# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
16668template <
class t_TYPE,
class t_INIT_LIST_TYPE,
class... t_ARGS>
16708# if BSLS_COMPILERFEATURES_CPLUSPLUS >= 202002L && \
16709 defined(BSLS_LIBRARYFEATURES_STDCPP_GNU) && \
16710 (11 <= _GLIBCXX_RELEASE && _GLIBCXX_RELEASE <= 14)
16712#define BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_GNU_WORKAROUND_NEEDED
16715template<
typename _Tp>
16716inline constexpr bool __is_optional_v<bsl::optional<_Tp>> =
true;
16721# if BSLS_COMPILERFEATURES_CPLUSPLUS == 202002L && \
16722 defined(BSLS_PLATFORM_CMP_MSVC) && \
16723 (BSLS_PLATFORM_CMP_VERSION >= 1930 && BSLS_PLATFORM_CMP_VERSION < 1936)
16726#define BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_MSVC_WORKAROUND_NEEDED
16729template <
typename _Tp>
16730inline constexpr bool _Is_specialization_v<bsl::optional<_Tp>, std::optional> =
16736#undef BSLSTL_OPTIONAL_CONSTEXPR17
16737#undef BSLSTL_OPTIONAL_CONSTEXPR20
16738#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL
16739#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL
16740#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL
16741#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL
16742#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR
16743#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR
16744#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR
16745#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR
16746#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM
16747#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM
16748#undef BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL
16749#undef BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT
16750#undef BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT
16751#undef BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT
16752#undef BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT
16753#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL
16754#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL
16755#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED
16756#undef BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG
16757#undef BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG
16758#undef BSLSTL_OPTIONAL_REQUIRES
16761# error Not valid except when included from bslstl_optional.h
#define BSLMF_NESTED_TRAIT_DECLARATION(t_TYPE, t_TRAIT)
Definition bslmf_nestedtraitdeclaration.h:231
#define BSLMF_NESTED_TRAIT_DECLARATION_IF(t_TYPE, t_TRAIT, t_COND)
Definition bslmf_nestedtraitdeclaration.h:243
Definition bslma_bslallocator.h:588
decay_imp< U, k_ISARRAY, k_ISFUNC >::type type
Definition bslmf_decay.h:167
Definition bslstl_optional.h:2043
BSLSTL_OPTIONAL_CONSTEXPR20 optional & operator=(bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:5546
BSLSTL_OPTIONAL_CONSTEXPR17 optional() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:5142
Definition bslma_allocator.h:545
Optional_Base()
Definition bslstl_optional.h:3573
t_TYPE & emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
Definition bslstl_optional.h:3920
Optional_Base & operator=(const Optional_Base &rhs)
Definition bslstl_optional.h:4046
void assignOrEmplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) rhs)
Definition bslstl_optional.h:3884
t_TYPE & dereferenceRaw()
Definition bslstl_optional.h:3896
allocator_type AllocType
Definition bslstl_optional.h:944
bool has_value() const BSLS_KEYWORD_NOEXCEPT
Return false if this object is disengaged, and true otherwise.
Definition bslstl_optional.h:4138
t_TYPE value_or(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const
Definition bslstl_optional.h:4218
void swap(Optional_Base &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl t_TYPE & value()
Definition bslstl_optional.h:1305
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Return allocator used for construction of value_type.
Definition bslstl_optional.h:4129
t_TYPE & operator*()
Definition bslstl_optional.h:4115
void reset() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:3943
t_TYPE value_type
Definition bslstl_optional.h:938
bsl::allocator< char > allocator_type
Definition bslstl_optional.h:940
t_TYPE * operator->()
Definition bslstl_optional.h:4086
#define BSLMF_MOVABLEREF_DEDUCE(...)
Definition bslmf_movableref.h:691
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_ASSERT_INVOKE_NORETURN(X)
Definition bsls_assert.h:2101
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_THROW(X)
Definition bsls_exceptionutil.h:374
#define BSLS_NOTHROW_SPEC
Definition bsls_exceptionutil.h:386
#define BSLS_KEYWORD_CONSTEXPR
Definition bsls_keyword.h:624
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:651
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#define BSLS_UTIL_ADDRESSOF(OBJ)
Definition bsls_util.h:296
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:429
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:343
#define BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(DERIVED)
Definition bslstl_optional.h:399
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE, ANY_TYPE)
Definition bslstl_optional.h:369
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:437
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( TYPE, ANY_TYPE)
Definition bslstl_optional.h:375
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE)
Definition bslstl_optional.h:388
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:335
#define BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(U, V)
Definition bslstl_optional.h:419
#define BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(ARG)
Definition bslstl_optional.h:474
#define BSLSTL_OPTIONAL_CONSTEXPR20
Definition bslstl_optional.h:249
#define BSLSTL_OPTIONAL_REQUIRES(EXPR)
Definition bslstl_optional.h:490
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE)
Definition bslstl_optional.h:394
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:356
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(TYPE, ANY_TYPE)
Definition bslstl_optional.h:465
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE, ANY_TYPE)
Definition bslstl_optional.h:362
#define BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(DERIVED)
Definition bslstl_optional.h:405
#define BSLSTL_OPTIONAL_CONSTEXPR17
Definition bslstl_optional.h:248
#define BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(U, V)
Definition bslstl_optional.h:414
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:349
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_FORWARD_REF(TYPE, ANY_TYPE)
Definition bslstl_optional.h:454
#define BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(U, V)
Definition bslstl_optional.h:424
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( TYPE, ANY_TYPE)
Definition bslstl_optional.h:382
#define BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(U, V)
Definition bslstl_optional.h:409
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED(TYPE, DERIVED)
Definition bslstl_optional.h:446
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 MetricId &lhs, const MetricId &rhs)
void reset(TYPE *object)
Reset the value of the specified object to its default value.
bool operator>=(const Guid &lhs, const Guid &rhs)
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const BigEndianInt16 &object)
bool operator<=(const Guid &lhs, const Guid &rhs)
bool operator>(const Guid &lhs, const Guid &rhs)
Decimal32 operator*(Decimal32 lhs, Decimal32 rhs)
Definition bdlat_valuetypefunctions.h:939
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const array< TYPE, SIZE > &input)
Pass the specified input to the specified hashAlgorithm
Definition bslstl_array.h:959
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
const in_place_t in_place
ALLOCATOR & lhs
Definition bslstl_string.h:3917
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator==(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator==(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator!=(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator!=(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator<(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator<(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator>(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator>(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator<=(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator<=(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator>=(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLSTL_OPTIONAL_CONSTEXPR17 bool operator>=(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bsl::optional< typename bsl::decay< t_TYPE >::type > make_optional(bsl::allocator_arg_t, const typename bsl::optional< typename bsl::decay< t_TYPE >::type >::allocator_type &alloc, BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) rhs)
called in constant expressions only if t_LHS_TYPE is not allocator-aware.
Definition bslstl_optional.h:3306
Definition baljsn_encoder_testtypes.h:76
Definition bslstl_algorithm.h:84
Definition bdldfp_decimal.h:5549
Definition bslmf_allocatorargt.h:433
Definition bslmf_enableif.h:530
Definition bslstl_inplace.h:103
Definition bslmf_integralconstant.h:261
Definition bslmf_isnothrowmoveconstructible.h:361
Definition bslstl_optional.h:522
BSLS_KEYWORD_CONSTEXPR nullopt_t(t_TYPE, typename enable_if< is_same< t_TYPE, BloombergLP::bslstl::Optional_NulloptConstructToken >::value, int >::type=0) BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:529
t_TYPE type
This typedef is an alias to the (template parameter) t_TYPE.
Definition bslmf_removeconst.h:164
t_TYPE type
This typedef is an alias to the (template parameter) t_TYPE.
Definition bslmf_removereference.h:156
Definition bslmf_isbitwisecopyable.h:298
t_TYPE & emplace(bslma::Allocator *allocator, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
Definition bslstl_optional.h:3430
Optional_DataImp() BSLS_KEYWORD_NOEXCEPT
Create an empty Optional_DataImp object.
Definition bslstl_optional.h:3402
bool hasValue() const BSLS_KEYWORD_NOEXCEPT
Return true if this objects has a value, and false otherwise.
Definition bslstl_optional.h:3507
t_TYPE & value()
Definition bslstl_optional.h:3495
void reset() BSLS_KEYWORD_NOEXCEPT
Destroy the value_type object in d_buffer, if any.
Definition bslstl_optional.h:3464
~Optional_Data()
Destroy the managed value_type object, if it exists.
Definition bslstl_optional.h:3557
Definition bslstl_optional.h:601
BSLS_KEYWORD_CONSTEXPR Optional_OptNoSuchType(int) BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:632
Definition bsls_objectbuffer.h:277
TYPE * address()
Definition bsls_objectbuffer.h:335
TYPE & object()
Definition bsls_objectbuffer.h:352