BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl_optional_cpp03.h
Go to the documentation of this file.
1/// @file bslstl_optional_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstl_optional_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BSLSTL_OPTIONAL_CPP03
12#define INCLUDED_BSLSTL_OPTIONAL_CPP03
13
14/// @defgroup bslstl_optional_cpp03 bslstl_optional_cpp03
15/// @brief Provide C++03 implementation for bslstl_optional.h
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslstl
19/// @{
20/// @addtogroup bslstl_optional_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslstl_optional_cpp03-purpose"> Purpose</a>
25/// * <a href="#bslstl_optional_cpp03-classes"> Classes </a>
26/// * <a href="#bslstl_optional_cpp03-description"> Description </a>
27///
28/// # Purpose {#bslstl_optional_cpp03-purpose}
29/// Provide C++03 implementation for bslstl_optional.h
30///
31/// # Classes {#bslstl_optional_cpp03-classes}
32/// See bslstl_optional.h for list of classes
33///
34/// @see bslstl_optional
35///
36/// # Description {#bslstl_optional_cpp03-description}
37/// This component is the C++03 translation of a C++11 component,
38/// generated by the 'sim_cpp11_features.pl' program. If the original header
39/// contains any specially delimited regions of C++11 code, then this generated
40/// file contains the C++03 equivalent, i.e., with variadic templates expanded
41/// and rvalue-references replaced by 'bslmf::MovableRef' objects. The header
42/// code in this file is designed to be '#include'd into the original header
43/// when compiling with a C++03 compiler. If there are no specially delimited
44/// regions of C++11 code, then this header contains no code and is not
45/// '#include'd in the original header.
46///
47/// Generated on Sun Sep 1 05:39:10 2024
48/// Command line: sim_cpp11_features.pl bslstl_optional.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bsl
54 * @{
55 */
56/** @addtogroup bslstl
57 * @{
58 */
59/** @addtogroup bslstl_optional_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BSLSTL_OPTIONAL_H
64
65// ============================================================================
66// Section: BSLSTL_OPTIONAL_* Macros
67// ============================================================================
68
69# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
70
71// This macro is defined as 'std::is_constructible<U, V>::value' in C++11 and
72// later, and as 'DEFAULT' in C++03 with the value of 'DEFAULT' typically
73// chosen to not affect the constraint this macro appears in. Note that
74// 'is_constructible', unlike 'is_convertible', is 'true' for both implicitly
75// and explicitly constructible conversions.
76#define BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(U, V, DEFAULT) \
77 std::is_constructible<U, V>::value
78
79// This macro is defined as 'std::is_assignable<U, V>::value' in C++11 and
80// later, and as 'DEFAULT' in C++03 with the value of 'DEFAULT' typically
81// chosen to not affect the constraint this macro appears in.
82#define BSLSTL_OPTIONAL_IS_ASSIGNABLE(U, V, DEFAULT) \
83 std::is_assignable<U, V>::value
84
85# else // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
86
87#define BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(U, V, DEFAULT) DEFAULT
88
89#define BSLSTL_OPTIONAL_IS_ASSIGNABLE(U, V, DEFAULT) DEFAULT
90
91# endif // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY else
92
93// As in 'std' implementation, if the 'TYPE' converts from any value category
94// of an optional type 'OPT_TYPE', we consider it convertible from that
95// optional type.
96#define BSLSTL_OPTIONAL_CONVERTS_FROM(TYPE, OPT_TYPE) \
97 (bsl::is_convertible<const OPT_TYPE&, TYPE>::value || \
98 bsl::is_convertible<OPT_TYPE&, TYPE>::value || \
99 bsl::is_convertible<const OPT_TYPE, TYPE>::value || \
100 bsl::is_convertible<OPT_TYPE, TYPE>::value || \
101 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, const OPT_TYPE&, false) || \
102 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, OPT_TYPE&, false) || \
103 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, const OPT_TYPE, false) || \
104 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, OPT_TYPE, false))
105
106// As in 'std' implementation, if the 'TYPE' can be assigned to from any value
107// category of an optional type 'OPT_TYPE', we consider it convertible from
108// that optional type.
109# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
110#define BSLSTL_OPTIONAL_ASSIGNS_FROM(TYPE, OPT_TYPE) \
111 (std::is_assignable<TYPE&, const OPT_TYPE&>::value || \
112 std::is_assignable<TYPE&, OPT_TYPE&>::value || \
113 std::is_assignable<TYPE&, const OPT_TYPE>::value || \
114 std::is_assignable<TYPE&, OPT_TYPE>::value)
115
116# else // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
117// The value of this macro is chosen so it does not affect the disjunction-form
118// constraint this macro appears in.
119#define BSLSTL_OPTIONAL_ASSIGNS_FROM(TYPE, OPT_TYPE) false
120# endif // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY else
121
122#define BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) \
123 BSLSTL_OPTIONAL_CONVERTS_FROM( \
124 TYPE, \
125 bsl::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
126
127#define BSLSTL_OPTIONAL_ASSIGNS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) \
128 BSLSTL_OPTIONAL_ASSIGNS_FROM( \
129 TYPE, \
130 bsl::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
131
132# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
133#define BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) \
134 BSLSTL_OPTIONAL_CONVERTS_FROM( \
135 TYPE, \
136 std::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
137
138#define BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) \
139 BSLSTL_OPTIONAL_ASSIGNS_FROM( \
140 TYPE, \
141 std::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
142# else // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
143// The value of these macros is chosen to not affect the constraints these
144// macros appears in.
145#define BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) false
146#define BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) false
147
148# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY else
149
150// Macros to define common constraints that enable a constructor or assignment
151// operator.
152#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE, \
153 ANY_TYPE) \
154 typename bsl::enable_if< \
155 !bsl::is_same<TYPE, ANY_TYPE>::value && \
156 !BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) && \
157 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true), \
158 BloombergLP::bslstl::Optional_OptNoSuchType>::type
159
160#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE, \
161 ANY_TYPE) \
162 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL( \
163 TYPE, \
164 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
165
166#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE, \
167 ANY_TYPE) \
168 typename bsl::enable_if< \
169 !BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) && \
170 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true), \
171 BloombergLP::bslstl::Optional_OptNoSuchType>::type
172
173#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE, \
174 ANY_TYPE) \
175 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL( \
176 TYPE, \
177 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
178
179#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE, \
180 ANY_TYPE) \
181 typename bsl::enable_if< \
182 BloombergLP::bslstl::Optional_PropagatesAllocator<TYPE, \
183 ANY_TYPE>::value, \
184 BloombergLP::bslstl::Optional_OptNoSuchType>::type
185
186#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE, \
187 ANY_TYPE) \
188 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR( \
189 TYPE, \
190 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
191
192#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( \
193 TYPE, ANY_TYPE) \
194 typename bsl::enable_if< \
195 !BloombergLP::bslstl::Optional_PropagatesAllocator<TYPE, \
196 ANY_TYPE>::value, \
197 BloombergLP::bslstl::Optional_OptNoSuchType>::type
198
199#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( \
200 TYPE, ANY_TYPE) \
201 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( \
202 TYPE, \
203 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
204
205#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE) \
206 typename bsl::enable_if< \
207 BloombergLP::bslstl::Optional_ConstructsFromType<TYPE, \
208 ANY_TYPE>::value, \
209 BloombergLP::bslstl::Optional_OptNoSuchType>::type
210
211#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE) \
212 BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM( \
213 TYPE, \
214 ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
215
216#define BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(DERIVED) \
217 typename bsl::enable_if< \
218 BloombergLP::bslmf::IsAccessibleBaseOf<optional, DERIVED>::value && \
219 !bsl::is_const<DERIVED>::value, \
220 BloombergLP::bslstl::Optional_OptNoSuchType>::type
221
222#define BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(DERIVED) \
223 BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(DERIVED) = \
224 BloombergLP::bslstl::Optional_OptNoSuchType(0)
225
226#define BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(U, V) \
227 typename bsl::enable_if< \
228 !bsl::is_convertible<V, U>::value, \
229 BloombergLP::bslstl::Optional_OptNoSuchType>::type
230
231#define BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(U, V) \
232 BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT( \
233 U, \
234 V) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
235
236#define BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(U, V) \
237 typename bsl::enable_if< \
238 bsl::is_convertible<V, U>::value, \
239 BloombergLP::bslstl::Optional_OptNoSuchType>::type
240
241#define BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(U, V) \
242 BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT( \
243 U, \
244 V) = BloombergLP::bslstl::Optional_OptNoSuchType(0)
245
246#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) \
247 typename bsl::enable_if< \
248 !BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) && \
249 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true) && \
250 BSLSTL_OPTIONAL_IS_ASSIGNABLE(TYPE&, ANY_TYPE, true) && \
251 !BSLSTL_OPTIONAL_ASSIGNS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE), \
252 optional<TYPE> >::type
253
254#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) \
255 typename bsl::enable_if< \
256 !BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) && \
257 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true) && \
258 BSLSTL_OPTIONAL_IS_ASSIGNABLE(TYPE&, ANY_TYPE, true) && \
259 !BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE), \
260 optional<TYPE> >::type
261
262# if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
263# define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED(TYPE, DERIVED) \
264 typename bsl::enable_if< \
265 BloombergLP::bslmf::IsAccessibleBaseOf<bsl::optional<TYPE>, \
266 DERIVED>::value && \
267 !bsl::is_same<bsl::optional<TYPE>, DERIVED>::value, \
268 optional<TYPE> >::type
269# endif
270
271#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_FORWARD_REF(TYPE, ANY_TYPE) \
272 typename bsl::enable_if< \
273 !bsl::is_same<bsl::optional<TYPE>, \
274 typename bsl::remove_cvref<ANY_TYPE>::type>::value && \
275 !(bsl::is_same<TYPE, \
276 typename bsl::decay<ANY_TYPE>::type>::value && \
277 std::is_scalar<TYPE>::value) && \
278 std::is_constructible<TYPE, ANY_TYPE>::value && \
279 std::is_assignable<TYPE, ANY_TYPE>::value, \
280 optional<TYPE> >::type
281
282#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(TYPE, ANY_TYPE) \
283 typename bsl::enable_if< \
284 !::BloombergLP::bslmf::IsAccessibleBaseOf< \
285 bsl::optional<TYPE>, \
286 typename bsl::remove_cv< \
287 typename ::BloombergLP::bslmf::MovableRefUtil:: \
288 RemoveReference<ANY_TYPE>::type>::type>::value, \
289 optional<TYPE> >::type
290
291#define BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(ARG) \
292 typename bsl::enable_if< \
293 !bsl::is_same< \
294 typename bsl::remove_cvref<ARG>::type, \
295 bsl::allocator_arg_t>::value, \
296 optional<t_TYPE> >::type
297
298#ifdef BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS
299 #define BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(ARG) = ARG
300#else
301 #define BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(ARG)
302#endif
303
304#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
305 #define BSLSTL_OPTIONAL_REQUIRES(EXPR) requires(EXPR)
306#else
307 #define BSLSTL_OPTIONAL_REQUIRES(EXPR)
308#endif
309
310
311namespace bslstl {
312/// This trivial tag type is used to create `nullopt_t` objects prior to
313/// C++17.
314struct Optional_NulloptConstructToken {
315};
316} // close package namespace
317
318
319namespace bsl {
320
321# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
322
323using nullopt_t = std::nullopt_t;
324using std::nullopt;
325
326# else // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
327
328 // ================
329 // struct nullopt_t
330 // ================
331
332struct nullopt_t {
333 // This trivial tag type is used to create 'optional' objects in a
334 // disengaged state. It uses a constructor template to avoid being
335 // constructible from any braced list. See implementation notes for more
336 // information.
337
338 // CREATORS
339 template <class t_TYPE>
341 t_TYPE,
342 typename enable_if<is_same<t_TYPE,
343 BloombergLP::bslstl::
344 Optional_NulloptConstructToken>::value,
345 int>::type = 0) BSLS_KEYWORD_NOEXCEPT
346 // Create a 'nullopt_t' object. Note that the argument is not used.
347 {
348 }
349};
350
351# if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES)
352inline constexpr
353nullopt_t nullopt(BloombergLP::bslstl::Optional_NulloptConstructToken{});
354# else
355extern const nullopt_t nullopt;
356# endif
357 // Value of type 'nullopt_t' used as an argument to functions that take a
358 // 'nullopt_t' argument.
359
360# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
361
362template <class t_TYPE>
363class optional;
364
365} // close namespace bsl
366
367// ============================================================================
368// Section: bslstl::Optional_* Utility Classes
369// ============================================================================
370
371
372namespace bslstl {
373
374 // =======================================
375 // struct Optional_IsTriviallyDestructible
376 // =======================================
377
378# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
379
380/// This metafunction is derived from
381/// `std::is_trivially_destructible<t_TYPE>` in C++11 and later. In C++03,
382/// the metafunction is derived from `bsl::is_trivially_copyable`, a trait
383/// that implies the type is also trivially destructible.
384template <class t_TYPE>
385struct Optional_IsTriviallyDestructible
386: std::is_trivially_destructible<t_TYPE> {
387};
388
389# else // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
390
391template <class t_TYPE>
392struct Optional_IsTriviallyDestructible : bslmf::IsBitwiseCopyable<t_TYPE> {
393 // C++03 does not provide a trivially destructible trait. Instead we use
394 // 'bslmf::IsBitwiseCopyable' which implies the type is also trivially
395 // destructible.
396 //
397 // Note that we use 'bslmf::IsBitwiseCopyable' here and not
398 // 'bsl::is_trivially_copyable' because on some platforms, the native
399 // 'std::is_trivially_copyable<Optional_Data<t_TYPE, true>>' is 'false'
400 // even though it has no d'tor and 'TYPE' is trivally copyable.
401};
402
403# endif // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY else
404
405 // ============================
406 // class Optional_OptNoSuchType
407 // ============================
408
409/// This component-private trivial tag type is used to distinguish between
410/// arguments passed by a user, and an `enable_if` argument. It is not
411/// default constructible so the following construction never invokes a
412/// constrained single parameter constructor:
413/// @code
414/// optional<SomeType> o(int, {});
415/// @endcode
416struct Optional_OptNoSuchType {
417
418 // CREATORS
419
420 /// Create an `Optional_OptNoSuchType` object. Note that the argument
421 /// is not used.
424};
425
426// CREATORS
427inline
430{
431}
432
433 // ==================================
434 // class Optional_PropagatesAllocator
435 // ==================================
436
437/// This metafunction is derived from `bsl::true_type` if `t_TYPE` is an
438/// allocator-aware const type, and if `t_ANY_TYPE` is the same as `t_TYPE`,
439/// minus the cv qualification. This trait is used to enable a constructor
440/// overload for a const qualified allocator-aware `ValueType` taking an
441/// rvalue of Optional_Base of the non-const qualified `ValueType`. Such an
442/// overload needs to propagate the allocator.
443template <class t_TYPE, class t_ANY_TYPE>
444struct Optional_PropagatesAllocator
446 bool,
447 bslma::UsesBslmaAllocator<t_TYPE>::value &&
448 bsl::is_const<t_TYPE>::value &&
449 bsl::is_same<t_ANY_TYPE,
450 typename bsl::remove_cv<t_TYPE>::type>::value> {
451};
452
453/// This metafunction is derived from `bsl::true_type` if `t_ANY_TYPE` is
454/// not derived from `bsl::optional<t_TYPE>`, `t_ANY_TYPE` is not a tag
455/// type, and `t_TYPE` is constructible from `t_ANY_TYPE`.
456template <class t_TYPE, class t_ANY_TYPE>
457struct Optional_ConstructsFromType
459 bool,
460 !bslmf::IsAccessibleBaseOf<
461 bsl::optional<t_TYPE>,
462 typename bsl::remove_cvref<t_ANY_TYPE>::type>::value &&
463 !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
464 bsl::nullopt_t>::value &&
465 !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
466 bsl::in_place_t>::value &&
467 !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
468 bsl::allocator_arg_t>::value &&
469 BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(t_TYPE, t_ANY_TYPE, true)> {
470};
471
472 // ===========================
473 // Component-Private Tag Types
474 // ===========================
475
476// The types defined in this section are used to select particular templated
477// constructors of 'class Optional_Base'. This avoids the need to duplicate
478// constraints between 'optional' and 'Optional_Base'.
479
480struct Optional_ConstructFromForwardRef {};
481struct Optional_CopyConstructFromOtherOptional {};
482struct Optional_MoveConstructFromOtherOptional {};
483struct Optional_CopyConstructFromStdOptional {};
484struct Optional_MoveConstructFromStdOptional {};
485
486 // ======================
487 // class Optional_DataImp
488 // ======================
489
490/// This component-private `struct` manages a `value_type` object in an
491/// `Optional_Base` object. This class provides an abstraction for `const`
492/// value type. An `Optional_Base` object may contain an object of `const`
493/// type. An assignment to such an `Optional_Base` object should not
494/// succeed. However, unless the `Optional_Base` object itself is `const`,
495/// it should be possible to change the value of the `Optional_Base` object
496/// using `emplace`. In order to allow for that, this class manages a
497/// non-const object of `value_type`, but all the accessors return a `const`
498/// adjusted reference to the managed object.
499template <class t_TYPE>
500struct Optional_DataImp {
501
502 private:
503 // PRIVATE TYPES
504 typedef typename bsl::remove_const<t_TYPE>::type StoredType;
505
506 // DATA
507
508 // in-place `TYPE` object
510
511 // `true` if object has a value, and `false` otherwise
512 bool d_hasValue;
513
514 public:
515 // CREATORS
516
517 /// Create an empty `Optional_DataImp` object.
519
520 // MANIPULATORS
521#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
522// {{{ BEGIN GENERATED CODE
523// Command line: sim_cpp11_features.pl bslstl_optional.h
524#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
525#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
526#endif
527#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_A
528#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_A BSLSTL_OPTIONAL_VARIADIC_LIMIT
529#endif
530#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0
531 t_TYPE& emplace(bslma::Allocator *allocator);
532#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0
533
534#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1
535 template <class t_ARGS_01>
536 t_TYPE& emplace(bslma::Allocator *allocator,
537 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
538#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1
539
540#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2
541 template <class t_ARGS_01,
542 class t_ARGS_02>
543 t_TYPE& emplace(bslma::Allocator *allocator,
544 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
545 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
546#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2
547
548#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3
549 template <class t_ARGS_01,
550 class t_ARGS_02,
551 class t_ARGS_03>
552 t_TYPE& emplace(bslma::Allocator *allocator,
553 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
554 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
555 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
556#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3
557
558#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4
559 template <class t_ARGS_01,
560 class t_ARGS_02,
561 class t_ARGS_03,
562 class t_ARGS_04>
563 t_TYPE& emplace(bslma::Allocator *allocator,
564 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
565 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
566 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
567 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
568#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4
569
570#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5
571 template <class t_ARGS_01,
572 class t_ARGS_02,
573 class t_ARGS_03,
574 class t_ARGS_04,
575 class t_ARGS_05>
576 t_TYPE& emplace(bslma::Allocator *allocator,
577 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
578 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
579 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
580 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
581 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
582#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5
583
584#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6
585 template <class t_ARGS_01,
586 class t_ARGS_02,
587 class t_ARGS_03,
588 class t_ARGS_04,
589 class t_ARGS_05,
590 class t_ARGS_06>
591 t_TYPE& emplace(bslma::Allocator *allocator,
592 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
593 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
594 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
595 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
596 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
597 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
598#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6
599
600#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7
601 template <class t_ARGS_01,
602 class t_ARGS_02,
603 class t_ARGS_03,
604 class t_ARGS_04,
605 class t_ARGS_05,
606 class t_ARGS_06,
607 class t_ARGS_07>
608 t_TYPE& emplace(bslma::Allocator *allocator,
609 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
610 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
611 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
612 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
613 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
614 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
615 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
616#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7
617
618#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8
619 template <class t_ARGS_01,
620 class t_ARGS_02,
621 class t_ARGS_03,
622 class t_ARGS_04,
623 class t_ARGS_05,
624 class t_ARGS_06,
625 class t_ARGS_07,
626 class t_ARGS_08>
627 t_TYPE& emplace(bslma::Allocator *allocator,
628 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
629 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
630 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
631 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
632 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
633 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
634 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
635 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
636#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8
637
638#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9
639 template <class t_ARGS_01,
640 class t_ARGS_02,
641 class t_ARGS_03,
642 class t_ARGS_04,
643 class t_ARGS_05,
644 class t_ARGS_06,
645 class t_ARGS_07,
646 class t_ARGS_08,
647 class t_ARGS_09>
648 t_TYPE& emplace(bslma::Allocator *allocator,
649 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
650 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
651 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
652 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
653 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
654 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
655 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
656 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
657 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
658#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9
659
660#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10
661 template <class t_ARGS_01,
662 class t_ARGS_02,
663 class t_ARGS_03,
664 class t_ARGS_04,
665 class t_ARGS_05,
666 class t_ARGS_06,
667 class t_ARGS_07,
668 class t_ARGS_08,
669 class t_ARGS_09,
670 class t_ARGS_10>
671 t_TYPE& emplace(bslma::Allocator *allocator,
672 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
673 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
674 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
675 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
676 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
677 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
678 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
679 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
680 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
681 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
682#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10
683
684
685# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
686#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0
687 template <class t_INIT_LIST_TYPE>
688 t_TYPE& emplace(
689 bslma::Allocator *allocator,
690 std::initializer_list<t_INIT_LIST_TYPE> initializer_list);
691#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0
692
693#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1
694 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
695 t_TYPE& emplace(
696 bslma::Allocator *allocator,
697 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
698 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
699#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1
700
701#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2
702 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
703 class t_ARGS_02>
704 t_TYPE& emplace(
705 bslma::Allocator *allocator,
706 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
707 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
708 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
709#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2
710
711#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3
712 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
713 class t_ARGS_02,
714 class t_ARGS_03>
715 t_TYPE& emplace(
716 bslma::Allocator *allocator,
717 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
718 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
719 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
720 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
721#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3
722
723#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4
724 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
725 class t_ARGS_02,
726 class t_ARGS_03,
727 class t_ARGS_04>
728 t_TYPE& emplace(
729 bslma::Allocator *allocator,
730 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
731 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
732 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
733 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
734 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
735#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4
736
737#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5
738 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
739 class t_ARGS_02,
740 class t_ARGS_03,
741 class t_ARGS_04,
742 class t_ARGS_05>
743 t_TYPE& emplace(
744 bslma::Allocator *allocator,
745 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
746 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
747 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
748 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
749 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
750 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
751#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5
752
753#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6
754 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
755 class t_ARGS_02,
756 class t_ARGS_03,
757 class t_ARGS_04,
758 class t_ARGS_05,
759 class t_ARGS_06>
760 t_TYPE& emplace(
761 bslma::Allocator *allocator,
762 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
763 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
764 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
765 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
766 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
767 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
768 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
769#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6
770
771#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7
772 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
773 class t_ARGS_02,
774 class t_ARGS_03,
775 class t_ARGS_04,
776 class t_ARGS_05,
777 class t_ARGS_06,
778 class t_ARGS_07>
779 t_TYPE& emplace(
780 bslma::Allocator *allocator,
781 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
782 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
783 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
784 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
785 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
786 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
787 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
788 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
789#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7
790
791#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8
792 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
793 class t_ARGS_02,
794 class t_ARGS_03,
795 class t_ARGS_04,
796 class t_ARGS_05,
797 class t_ARGS_06,
798 class t_ARGS_07,
799 class t_ARGS_08>
800 t_TYPE& emplace(
801 bslma::Allocator *allocator,
802 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
803 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
804 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
805 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
806 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
807 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
808 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
809 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
810 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
811#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8
812
813#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9
814 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
815 class t_ARGS_02,
816 class t_ARGS_03,
817 class t_ARGS_04,
818 class t_ARGS_05,
819 class t_ARGS_06,
820 class t_ARGS_07,
821 class t_ARGS_08,
822 class t_ARGS_09>
823 t_TYPE& emplace(
824 bslma::Allocator *allocator,
825 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
826 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
827 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
828 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
829 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
830 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
831 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
832 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
833 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
834 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
835#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9
836
837#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10
838 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
839 class t_ARGS_02,
840 class t_ARGS_03,
841 class t_ARGS_04,
842 class t_ARGS_05,
843 class t_ARGS_06,
844 class t_ARGS_07,
845 class t_ARGS_08,
846 class t_ARGS_09,
847 class t_ARGS_10>
848 t_TYPE& emplace(
849 bslma::Allocator *allocator,
850 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
851 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
852 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
853 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
854 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
855 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
856 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
857 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
858 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
859 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
860 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
861#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10
862
863# endif
864#else
865// The generated code below is a workaround for the absence of perfect
866// forwarding in some compilers.
867 template <class... t_ARGS>
868 t_TYPE& emplace(bslma::Allocator *allocator,
869 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
870
871# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
872 template <class t_INIT_LIST_TYPE, class... t_ARGS>
873 t_TYPE& emplace(
874 bslma::Allocator *allocator,
875 std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
876 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
877# endif
878// }}} END GENERATED CODE
879#endif
880
881 /// Destroy the `value_type` object in `d_buffer`, if any.
883
884# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
885 /// Return the `value_type` object in `d_buffer` with const
886 /// qualification adjusted to match that of `t_TYPE`. The behavior is
887 /// undefined unless `this->hasValue() == true`.
888 t_TYPE& value() &;
889 t_TYPE&& value() &&;
890# else
891 t_TYPE& value();
892 // Return the 'value_type' object in 'd_buffer' with const
893 // qualification adjusted to match that of 't_TYPE'. The behavior is
894 // undefined unless 'this->hasValue() == true'.
895# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
896
897 // ACCESSORS
898
899 /// Return `true` if this objects has a value, and `false` otherwise.
900 bool hasValue() const BSLS_KEYWORD_NOEXCEPT;
901
902# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
903 /// Return the `value_type` object in `d_buffer` with const
904 /// qualification adjusted to match that of `t_TYPE`. The behavior is
905 /// undefined unless `this->hasValue() == true`.
906 const t_TYPE& value() const &;
907 const t_TYPE&& value() const &&;
908
909# else
910 const t_TYPE& value() const;
911 // Return the 'value_type' object in 'd_buffer' with const
912 // qualification adjusted to match that of 't_TYPE'. The behavior is
913 // undefined unless 'this->hasValue() == true'.
914# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
915};
916
917 // ===================
918 // class Optional_Data
919 // ===================
920
921/// This component-private `struct` manages a `value_type` object in
922/// `Optional_Base` by inheriting from `Optional_DataImp`. In addition,
923/// this primary template properly destroys the owned instance of `t_TYPE`
924/// in its destructor.
925template <
926 class t_TYPE,
927 bool t_IS_TRIVIALLY_DESTRUCTIBLE =
929struct Optional_Data : public Optional_DataImp<t_TYPE> {
930
931 public:
932 // CREATORS
933
934 /// Destroy the managed `value_type` object, if it exists.
936};
937
938 // ===================
939 // class Optional_Data
940 // ===================
941
942/// This partial specialization manages a trivially destructible
943/// `value_type` in Optional_Base. It does not have a user-provided
944/// destructor, which makes it `is_trivially_destructible` itself.
945template <class t_TYPE>
946struct Optional_Data<t_TYPE, true> : public Optional_DataImp<t_TYPE> {
947
948 public:
952};
953
954 // ==========================
955 // Component-private concepts
956 // ==========================
957
958#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
959template <class t_TYPE>
960void optional_acceptsBslOptional(const bsl::optional<t_TYPE>&);
961
962template <class t_TYPE>
963void optional_acceptsStdOptional(const std::optional<t_TYPE>&);
964
965template <class t_TYPE>
966concept Optional_ConvertibleToBool =
967 // This component-private concept models the Standard's exposition-only
968 // 'boolean-testable' concept.
969 bsl::is_convertible_v<t_TYPE, bool>;
970
971template <class t_TYPE>
972concept Optional_DerivedFromBslOptional =
973 // This component-private concept is used in the subsequent implementation
974 // of the component-private concept 'Optional_DerivedFromOptional'.
975 requires (const t_TYPE& t) { optional_acceptsBslOptional(t); };
976
977template <class t_TYPE>
978concept Optional_DerivedFromStdOptional =
979 // This component-private concept is used in the subsequent implementation
980 // of the component-private concept 'Optional_DerivedFromOptional'.
981 requires (const t_TYPE& t) { optional_acceptsStdOptional(t); };
982
983template <class t_TYPE>
984concept Optional_DerivedFromOptional =
985 // This component-private concept models whether a type is derived from one
986 // of 'std::optional' or 'bsl::optional'.
987 Optional_DerivedFromBslOptional<t_TYPE> ||
988 Optional_DerivedFromStdOptional<t_TYPE>;
989#endif
990
991// ============================================================================
992// Section: Definition of Allocator-Aware 'Optional_Base'
993// ============================================================================
994
995 // ===================
996 // class Optional_Base
997 // ===================
998
999/// This component-private class template implements the functionality of
1000/// `bsl::optional`. The primary template is instantiated when `TYPE` is
1001/// allocator-aware, and holds the allocator that is used to create the
1002/// stored object.
1003///
1004/// See @ref bslstl_optional_cpp03
1005template <class t_TYPE,
1006 bool t_USES_BSLMA_ALLOC =
1007 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>
1008class Optional_Base {
1009
1010 public:
1011 // TYPES
1012
1013 /// `value_type` is an alias for the underlying `TYPE` upon which this
1014 /// template class is instantiated, and represents the type of the
1015 /// managed object. The name is chosen so it is compatible with the
1016 /// `std::optional` implementation.
1017 typedef t_TYPE value_type;
1018
1020
1021 protected:
1022 // PROTECTED TYPES
1023 typedef allocator_type AllocType;
1024
1025 private:
1026 // PRIVATE TYPES
1027 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
1028
1029# ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
1030 // UNSPECIFIED BOOL
1031
1032 // This type is needed only in C++03 mode, where 'explicit' conversion
1033 // operators are not supported. An 'optional' object is contextually
1034 // converted to 'UnspecifiedBool' when used in 'if' statements, but is not
1035 // implicitly convertible to 'bool'.
1036 typedef BloombergLP::bsls::UnspecifiedBool<Optional_Base>
1037 UnspecifiedBoolUtil;
1038 typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
1039# endif
1040
1041 // DATA
1042
1043 // in-place `TYPE` object
1044 BloombergLP::bslstl::Optional_Data<t_TYPE> d_value;
1045
1046 // allocator to be used for all in-place `TYPE` objects
1047 allocator_type d_allocator;
1048
1049 protected:
1050 // PROTECTED CREATORS
1051
1052 /// Create a disengaged `Optional_Base` object. Use the currently
1053 /// installed default allocator to supply memory.
1054 Optional_Base();
1055
1056 /// Create a disengaged `Optional_Base` object. Use the currently
1057 /// installed default allocator to supply memory.
1058 Optional_Base(bsl::nullopt_t); // IMPLICIT
1059
1060 Optional_Base(const Optional_Base& original);
1061 /// Create an `Optional_Base` object having the value of the specified
1062 /// `original` object. Use the currently installed default allocator to
1063 /// supply memory.
1064
1065 Optional_Base(BloombergLP::bslmf::MovableRef<Optional_Base> original)
1068 // Create an 'Optional_Base' object having the same value as the
1069 // specified 'original' object by moving the contents of 'original' to
1070 // the newly-created object. The allocator associated with 'original'
1071 // is propagated for use in the newly-created object. 'original' is
1072 // left in a valid, but unspecified state.
1073
1074 /// Create an `Optional_Base` object whose contained value is
1075 /// initialized by forwarding from the specified `value`. Use the
1076 /// currently installed default allocator to supply memory.
1077 template <class t_ANY_TYPE>
1078 Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
1080
1081 /// Create a disengaged `Optional_Base` object if the specified
1082 /// `original` object is disengaged, and an `Optional_Base` object with
1083 /// the value of `original.value()` converted to `t_TYPE` otherwise.
1084 /// Use the currently installed default allocator to supply memory.
1085 template <class t_ANY_TYPE>
1086 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
1087 const Optional_Base<t_ANY_TYPE>& original);
1088
1089 /// Create a disengaged `Optional_Base` object if the specified
1090 /// `original` object is disengaged, and an `Optional_Base` object with
1091 /// the value of `original.value()` converted to `t_TYPE` otherwise.
1092 /// Use the currently installed default allocator to supply memory.
1093 /// `original` is left in a valid but unspecified state.
1094 template <class t_ANY_TYPE>
1096 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
1097 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original,
1099 t_TYPE,
1100 t_ANY_TYPE));
1101
1102 /// Create a disengaged `Optional_Base` object if the specified
1103 /// `original` object is disengaged, and an `Optional_Base` object with
1104 /// the value of `original.value()` otherwise. This is a special case
1105 /// constructor where `t_ANY_TYPE` is a non-const version of `t_TYPE`
1106 /// and we use the allocator from `original` to supply memory.
1107 /// `original` is left in a valid but unspecified state.
1108 template <class t_ANY_TYPE>
1110 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
1111 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original,
1113 t_ANY_TYPE));
1114
1115# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
1116 /// Create a disengaged `Optional_Base` object if the specified
1117 /// `original` object is disengaged, and an `Optional_Base` object with
1118 /// the value of `original.value()` converted to `t_TYPE` otherwise.
1119 /// Use the currently installed default allocator to supply memory.
1120 template <class t_ANY_TYPE>
1121 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
1122 const std::optional<t_ANY_TYPE>& original);
1123
1124 /// Create a disengaged `Optional_Base` object if the specified
1125 /// `original` object is disengaged, and an `Optional_Base` object with
1126 /// the value of `original.value()` converted to `t_TYPE` otherwise.
1127 /// Use the currently installed default allocator to supply memory.
1128 template <class t_ANY_TYPE>
1129 Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
1130 std::optional<t_ANY_TYPE>&& original);
1131# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
1132
1133#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1134// {{{ BEGIN GENERATED CODE
1135// Command line: sim_cpp11_features.pl bslstl_optional.h
1136#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
1137#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
1138#endif
1139#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_B
1140#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_B BSLSTL_OPTIONAL_VARIADIC_LIMIT
1141#endif
1142#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0
1144#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0
1145
1146#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1
1147 template <class t_ARGS_01>
1149 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
1150#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1
1151
1152#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2
1153 template <class t_ARGS_01,
1154 class t_ARGS_02>
1156 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1157 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
1158#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2
1159
1160#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3
1161 template <class t_ARGS_01,
1162 class t_ARGS_02,
1163 class t_ARGS_03>
1165 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1166 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1167 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
1168#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3
1169
1170#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4
1171 template <class t_ARGS_01,
1172 class t_ARGS_02,
1173 class t_ARGS_03,
1174 class t_ARGS_04>
1176 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1177 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1178 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1179 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
1180#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4
1181
1182#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5
1183 template <class t_ARGS_01,
1184 class t_ARGS_02,
1185 class t_ARGS_03,
1186 class t_ARGS_04,
1187 class t_ARGS_05>
1189 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1190 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1191 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1192 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1193 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
1194#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5
1195
1196#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6
1197 template <class t_ARGS_01,
1198 class t_ARGS_02,
1199 class t_ARGS_03,
1200 class t_ARGS_04,
1201 class t_ARGS_05,
1202 class t_ARGS_06>
1204 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1205 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1206 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1207 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1208 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1209 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
1210#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6
1211
1212#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7
1213 template <class t_ARGS_01,
1214 class t_ARGS_02,
1215 class t_ARGS_03,
1216 class t_ARGS_04,
1217 class t_ARGS_05,
1218 class t_ARGS_06,
1219 class t_ARGS_07>
1221 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1222 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1223 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1224 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1225 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1226 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1227 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
1228#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7
1229
1230#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8
1231 template <class t_ARGS_01,
1232 class t_ARGS_02,
1233 class t_ARGS_03,
1234 class t_ARGS_04,
1235 class t_ARGS_05,
1236 class t_ARGS_06,
1237 class t_ARGS_07,
1238 class t_ARGS_08>
1240 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1241 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1242 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1243 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1244 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1245 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1246 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1247 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
1248#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8
1249
1250#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9
1251 template <class t_ARGS_01,
1252 class t_ARGS_02,
1253 class t_ARGS_03,
1254 class t_ARGS_04,
1255 class t_ARGS_05,
1256 class t_ARGS_06,
1257 class t_ARGS_07,
1258 class t_ARGS_08,
1259 class t_ARGS_09>
1261 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1262 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1263 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1264 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1265 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1266 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1267 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1268 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
1269 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
1270#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9
1271
1272#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10
1273 template <class t_ARGS_01,
1274 class t_ARGS_02,
1275 class t_ARGS_03,
1276 class t_ARGS_04,
1277 class t_ARGS_05,
1278 class t_ARGS_06,
1279 class t_ARGS_07,
1280 class t_ARGS_08,
1281 class t_ARGS_09,
1282 class t_ARGS_10>
1284 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1285 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1286 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1287 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1288 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1289 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1290 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1291 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
1292 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
1293 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
1294#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10
1295
1296# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1297#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0
1298 template <class t_INIT_LIST_TYPE>
1300 std::initializer_list<t_INIT_LIST_TYPE> il);
1301#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0
1302
1303#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1
1304 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
1306 std::initializer_list<t_INIT_LIST_TYPE> il,
1307 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
1308#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1
1309
1310#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2
1311 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1312 class t_ARGS_02>
1314 std::initializer_list<t_INIT_LIST_TYPE> il,
1315 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1316 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
1317#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2
1318
1319#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3
1320 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1321 class t_ARGS_02,
1322 class t_ARGS_03>
1324 std::initializer_list<t_INIT_LIST_TYPE> il,
1325 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1326 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1327 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
1328#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3
1329
1330#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4
1331 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1332 class t_ARGS_02,
1333 class t_ARGS_03,
1334 class t_ARGS_04>
1336 std::initializer_list<t_INIT_LIST_TYPE> il,
1337 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1338 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1339 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1340 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
1341#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4
1342
1343#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5
1344 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1345 class t_ARGS_02,
1346 class t_ARGS_03,
1347 class t_ARGS_04,
1348 class t_ARGS_05>
1350 std::initializer_list<t_INIT_LIST_TYPE> il,
1351 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1352 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1353 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1354 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1355 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
1356#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5
1357
1358#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6
1359 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1360 class t_ARGS_02,
1361 class t_ARGS_03,
1362 class t_ARGS_04,
1363 class t_ARGS_05,
1364 class t_ARGS_06>
1366 std::initializer_list<t_INIT_LIST_TYPE> il,
1367 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1368 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1369 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1370 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1371 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1372 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
1373#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6
1374
1375#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7
1376 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1377 class t_ARGS_02,
1378 class t_ARGS_03,
1379 class t_ARGS_04,
1380 class t_ARGS_05,
1381 class t_ARGS_06,
1382 class t_ARGS_07>
1384 std::initializer_list<t_INIT_LIST_TYPE> il,
1385 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1386 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1387 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1388 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1389 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1390 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1391 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
1392#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7
1393
1394#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8
1395 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1396 class t_ARGS_02,
1397 class t_ARGS_03,
1398 class t_ARGS_04,
1399 class t_ARGS_05,
1400 class t_ARGS_06,
1401 class t_ARGS_07,
1402 class t_ARGS_08>
1404 std::initializer_list<t_INIT_LIST_TYPE> il,
1405 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1406 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1407 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1408 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1409 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1410 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1411 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1412 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
1413#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8
1414
1415#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9
1416 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1417 class t_ARGS_02,
1418 class t_ARGS_03,
1419 class t_ARGS_04,
1420 class t_ARGS_05,
1421 class t_ARGS_06,
1422 class t_ARGS_07,
1423 class t_ARGS_08,
1424 class t_ARGS_09>
1426 std::initializer_list<t_INIT_LIST_TYPE> il,
1427 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1428 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1429 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1430 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1431 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1432 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1433 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1434 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
1435 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
1436#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9
1437
1438#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10
1439 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1440 class t_ARGS_02,
1441 class t_ARGS_03,
1442 class t_ARGS_04,
1443 class t_ARGS_05,
1444 class t_ARGS_06,
1445 class t_ARGS_07,
1446 class t_ARGS_08,
1447 class t_ARGS_09,
1448 class t_ARGS_10>
1450 std::initializer_list<t_INIT_LIST_TYPE> il,
1451 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1452 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1453 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1454 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1455 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1456 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1457 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1458 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
1459 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
1460 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
1461#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10
1462
1463# endif
1464#else
1465// The generated code below is a workaround for the absence of perfect
1466// forwarding in some compilers.
1467 template <class... t_ARGS>
1469 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
1470# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1471 template <class t_INIT_LIST_TYPE, class... t_ARGS>
1473 std::initializer_list<t_INIT_LIST_TYPE> il,
1474 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
1475# endif
1476// }}} END GENERATED CODE
1477#endif
1478
1479 // allocator-extended constructors
1480
1481 /// Create a disengaged `Optional_Base` object. Use the specified
1482 /// `allocator` to supply memory.
1483 Optional_Base(bsl::allocator_arg_t, allocator_type allocator);
1484
1485 /// Create a disengaged `Optional_Base` object. Use the specified
1486 /// `allocator` to supply memory.
1487 Optional_Base(bsl::allocator_arg_t,
1488 allocator_type allocator,
1490
1491 /// If the specified `original` contains a value, create an
1492 /// `Optional_Base` object whose contained value is initialized from
1493 /// `*original`. Otherwise, create a disengaged `Optional_Base` object.
1494 /// Use the specified `allocator` to supply memory.
1495 Optional_Base(bsl::allocator_arg_t,
1496 allocator_type allocator,
1497 const Optional_Base& original);
1498
1499 /// If the specified `original` contains a value, create an
1500 /// `Optional_Base` object whose contained value is initialized by
1501 /// moving `*original`. Otherwise, create a disengaged `Optional_Base`
1502 /// object. Use the specified `allocator` to supply memory. `original`
1503 /// is left in a valid but unspecified state.
1504 Optional_Base(bsl::allocator_arg_t,
1505 allocator_type allocator,
1506 BloombergLP::bslmf::MovableRef<Optional_Base> original);
1507
1508 /// Create an `Optional_Base` object whose contained value is
1509 /// initialized by forwarding from the specified `value`. Use the
1510 /// specified `allocator` to supply memory.
1511 template <class t_ANY_TYPE>
1512 Optional_Base(bsl::allocator_arg_t,
1513 allocator_type allocator,
1514 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
1516
1517 /// If the specified `original` contains a value, create an
1518 /// `Optional_Base` object whose contained value is initialized from
1519 /// `*original`, converted to `t_TYPE`. Otherwise, create a disengaged
1520 /// `Optional_Base`. Use the specified `allocator` to supply memory.
1521 template <class t_ANY_TYPE>
1522 Optional_Base(bsl::allocator_arg_t,
1523 allocator_type allocator,
1524 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
1525 const Optional_Base<t_ANY_TYPE>& original);
1526
1527 /// If the specified `original` contains a value, create an
1528 /// `Optional_Base` object whose contained value is initialized by
1529 /// moving from `*original` and converting to `t_TYPE`. Otherwise,
1530 /// create a disengaged `Optional_Base`. Use the specified `allocator`
1531 /// to supply memory. `original` is left in a valid but unspecified
1532 /// state.
1533 template <class t_ANY_TYPE>
1534 Optional_Base(bsl::allocator_arg_t,
1535 allocator_type allocator,
1536 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
1537 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original);
1538
1539# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
1540 /// If the specified `original` contains a value, create an
1541 /// `Optional_Base` object whose contained value is initialized from
1542 /// `*original`, converted to `t_TYPE`. Otherwise, create a disengaged
1543 /// `Optional_Base` object. Use the specified `allocator` to supply
1544 /// memory.
1545 template <class t_ANY_TYPE>
1546 Optional_Base(bsl::allocator_arg_t,
1547 allocator_type allocator,
1548 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
1549 const std::optional<t_ANY_TYPE>& original);
1550
1551 /// If the specified `original` contains a value, create an
1552 /// `Optional_Base` object whose contained value is initialized from
1553 /// moving from `*original` and converting to `t_TYPE`. Otherwise,
1554 /// create a disengaged `Optional_Base`. Use the specified `allocator`
1555 /// to supply memory. `original` is left in a valid but unspecified
1556 /// state.
1557 template <class t_ANY_TYPE>
1558 Optional_Base(bsl::allocator_arg_t,
1559 allocator_type allocator,
1560 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
1561 std::optional<t_ANY_TYPE>&& original);
1562# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
1563
1564#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1565// {{{ BEGIN GENERATED CODE
1566// Command line: sim_cpp11_features.pl bslstl_optional.h
1567#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
1568#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
1569#endif
1570#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_C
1571#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_C BSLSTL_OPTIONAL_VARIADIC_LIMIT
1572#endif
1573#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0
1574 Optional_Base(bsl::allocator_arg_t,
1575 allocator_type allocator,
1577#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0
1578
1579#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1
1580 template <class t_ARGS_01>
1581 Optional_Base(bsl::allocator_arg_t,
1582 allocator_type allocator,
1584 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
1585#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1
1586
1587#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2
1588 template <class t_ARGS_01,
1589 class t_ARGS_02>
1590 Optional_Base(bsl::allocator_arg_t,
1591 allocator_type allocator,
1593 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1594 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
1595#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2
1596
1597#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3
1598 template <class t_ARGS_01,
1599 class t_ARGS_02,
1600 class t_ARGS_03>
1601 Optional_Base(bsl::allocator_arg_t,
1602 allocator_type allocator,
1604 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1605 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1606 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
1607#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3
1608
1609#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4
1610 template <class t_ARGS_01,
1611 class t_ARGS_02,
1612 class t_ARGS_03,
1613 class t_ARGS_04>
1614 Optional_Base(bsl::allocator_arg_t,
1615 allocator_type allocator,
1617 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1618 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1619 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1620 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
1621#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4
1622
1623#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5
1624 template <class t_ARGS_01,
1625 class t_ARGS_02,
1626 class t_ARGS_03,
1627 class t_ARGS_04,
1628 class t_ARGS_05>
1629 Optional_Base(bsl::allocator_arg_t,
1630 allocator_type allocator,
1632 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1633 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1634 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1635 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1636 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
1637#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5
1638
1639#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6
1640 template <class t_ARGS_01,
1641 class t_ARGS_02,
1642 class t_ARGS_03,
1643 class t_ARGS_04,
1644 class t_ARGS_05,
1645 class t_ARGS_06>
1646 Optional_Base(bsl::allocator_arg_t,
1647 allocator_type allocator,
1649 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1650 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1651 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1652 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1653 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1654 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
1655#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6
1656
1657#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7
1658 template <class t_ARGS_01,
1659 class t_ARGS_02,
1660 class t_ARGS_03,
1661 class t_ARGS_04,
1662 class t_ARGS_05,
1663 class t_ARGS_06,
1664 class t_ARGS_07>
1665 Optional_Base(bsl::allocator_arg_t,
1666 allocator_type allocator,
1668 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1669 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1670 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1671 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1672 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1673 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1674 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
1675#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7
1676
1677#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8
1678 template <class t_ARGS_01,
1679 class t_ARGS_02,
1680 class t_ARGS_03,
1681 class t_ARGS_04,
1682 class t_ARGS_05,
1683 class t_ARGS_06,
1684 class t_ARGS_07,
1685 class t_ARGS_08>
1686 Optional_Base(bsl::allocator_arg_t,
1687 allocator_type allocator,
1689 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1690 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1691 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1692 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1693 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1694 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1695 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1696 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
1697#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8
1698
1699#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9
1700 template <class t_ARGS_01,
1701 class t_ARGS_02,
1702 class t_ARGS_03,
1703 class t_ARGS_04,
1704 class t_ARGS_05,
1705 class t_ARGS_06,
1706 class t_ARGS_07,
1707 class t_ARGS_08,
1708 class t_ARGS_09>
1709 Optional_Base(bsl::allocator_arg_t,
1710 allocator_type allocator,
1712 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1713 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1714 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1715 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1716 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1717 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1718 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1719 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
1720 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
1721#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9
1722
1723#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10
1724 template <class t_ARGS_01,
1725 class t_ARGS_02,
1726 class t_ARGS_03,
1727 class t_ARGS_04,
1728 class t_ARGS_05,
1729 class t_ARGS_06,
1730 class t_ARGS_07,
1731 class t_ARGS_08,
1732 class t_ARGS_09,
1733 class t_ARGS_10>
1734 Optional_Base(bsl::allocator_arg_t,
1735 allocator_type allocator,
1737 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1738 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1739 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1740 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1741 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1742 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1743 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1744 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
1745 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
1746 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
1747#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10
1748
1749
1750# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1751#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0
1752 template <class t_INIT_LIST_TYPE>
1753 Optional_Base(bsl::allocator_arg_t,
1754 allocator_type allocator,
1756 std::initializer_list<t_INIT_LIST_TYPE> il);
1757#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0
1758
1759#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1
1760 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
1761 Optional_Base(bsl::allocator_arg_t,
1762 allocator_type allocator,
1764 std::initializer_list<t_INIT_LIST_TYPE> il,
1765 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
1766#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1
1767
1768#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2
1769 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1770 class t_ARGS_02>
1771 Optional_Base(bsl::allocator_arg_t,
1772 allocator_type allocator,
1774 std::initializer_list<t_INIT_LIST_TYPE> il,
1775 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1776 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
1777#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2
1778
1779#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3
1780 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1781 class t_ARGS_02,
1782 class t_ARGS_03>
1783 Optional_Base(bsl::allocator_arg_t,
1784 allocator_type allocator,
1786 std::initializer_list<t_INIT_LIST_TYPE> il,
1787 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1788 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1789 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
1790#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3
1791
1792#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4
1793 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1794 class t_ARGS_02,
1795 class t_ARGS_03,
1796 class t_ARGS_04>
1797 Optional_Base(bsl::allocator_arg_t,
1798 allocator_type allocator,
1800 std::initializer_list<t_INIT_LIST_TYPE> il,
1801 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1802 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1803 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1804 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
1805#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4
1806
1807#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5
1808 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1809 class t_ARGS_02,
1810 class t_ARGS_03,
1811 class t_ARGS_04,
1812 class t_ARGS_05>
1813 Optional_Base(bsl::allocator_arg_t,
1814 allocator_type allocator,
1816 std::initializer_list<t_INIT_LIST_TYPE> il,
1817 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1818 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1819 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1820 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1821 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
1822#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5
1823
1824#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6
1825 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1826 class t_ARGS_02,
1827 class t_ARGS_03,
1828 class t_ARGS_04,
1829 class t_ARGS_05,
1830 class t_ARGS_06>
1831 Optional_Base(bsl::allocator_arg_t,
1832 allocator_type allocator,
1834 std::initializer_list<t_INIT_LIST_TYPE> il,
1835 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1836 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1837 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1838 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1839 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1840 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
1841#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6
1842
1843#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7
1844 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1845 class t_ARGS_02,
1846 class t_ARGS_03,
1847 class t_ARGS_04,
1848 class t_ARGS_05,
1849 class t_ARGS_06,
1850 class t_ARGS_07>
1851 Optional_Base(bsl::allocator_arg_t,
1852 allocator_type allocator,
1854 std::initializer_list<t_INIT_LIST_TYPE> il,
1855 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1856 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1857 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1858 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1859 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1860 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1861 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
1862#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7
1863
1864#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8
1865 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1866 class t_ARGS_02,
1867 class t_ARGS_03,
1868 class t_ARGS_04,
1869 class t_ARGS_05,
1870 class t_ARGS_06,
1871 class t_ARGS_07,
1872 class t_ARGS_08>
1873 Optional_Base(bsl::allocator_arg_t,
1874 allocator_type allocator,
1876 std::initializer_list<t_INIT_LIST_TYPE> il,
1877 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1878 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1879 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1880 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1881 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1882 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1883 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1884 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
1885#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8
1886
1887#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9
1888 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1889 class t_ARGS_02,
1890 class t_ARGS_03,
1891 class t_ARGS_04,
1892 class t_ARGS_05,
1893 class t_ARGS_06,
1894 class t_ARGS_07,
1895 class t_ARGS_08,
1896 class t_ARGS_09>
1897 Optional_Base(bsl::allocator_arg_t,
1898 allocator_type allocator,
1900 std::initializer_list<t_INIT_LIST_TYPE> il,
1901 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1902 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1903 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1904 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1905 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1906 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1907 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1908 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
1909 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
1910#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9
1911
1912#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10
1913 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
1914 class t_ARGS_02,
1915 class t_ARGS_03,
1916 class t_ARGS_04,
1917 class t_ARGS_05,
1918 class t_ARGS_06,
1919 class t_ARGS_07,
1920 class t_ARGS_08,
1921 class t_ARGS_09,
1922 class t_ARGS_10>
1923 Optional_Base(bsl::allocator_arg_t,
1924 allocator_type allocator,
1926 std::initializer_list<t_INIT_LIST_TYPE> il,
1927 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
1928 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
1929 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
1930 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
1931 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
1932 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
1933 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
1934 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
1935 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
1936 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
1937#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10
1938
1939# endif
1940#else
1941// The generated code below is a workaround for the absence of perfect
1942// forwarding in some compilers.
1943 template <class... t_ARGS>
1944 Optional_Base(bsl::allocator_arg_t,
1945 allocator_type allocator,
1947 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
1948
1949# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1950 template <class t_INIT_LIST_TYPE, class... t_ARGS>
1951 Optional_Base(bsl::allocator_arg_t,
1952 allocator_type allocator,
1954 std::initializer_list<t_INIT_LIST_TYPE> il,
1955 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
1956# endif
1957// }}} END GENERATED CODE
1958#endif
1959
1960 // PROTECTED MANIPULATORS
1961
1962 /// If `*this` holds an object, assign to that object the value of the
1963 /// specified `rhs`, converted to `t_TYPE`. Otherwise, construct a held
1964 /// object from `rhs`, converted to `t_TYPE`. The allocators of `*this`
1965 /// and `rhs` remain unchanged.
1966 template <class t_ANY_TYPE>
1968
1969# ifndef BDE_OMIT_INTERNAL_DEPRECATED
1970 /// Return a reference providing modifiable access to the underlying
1971 /// `t_TYPE` object. The behavior is undefined if the `Optional_Base`
1972 /// object is disengaged. Note that this function is only intended to
1973 /// be called by `bdlb::NullableValue::value` during transition of its
1974 /// implementation to use 'bsl::Optional_Base. Note that ref-qualified
1975 /// versions of `value()` are not provided because `NullableValue` does
1976 /// not require them.
1977 t_TYPE& dereferenceRaw();
1978
1979 // PROTECTED ACCESSORS
1980
1981 /// Return a reference providing non-modifiable access to the underlying
1982 /// `t_TYPE` object. The behavior is undefined if the `Optional_Base`
1983 /// object is disengaged. Note that this function is only intended to
1984 /// be called by `bdlb::NullableValue::value` during transition of its
1985 /// implementation to use 'bsl::Optional_Base. Note that ref-qualified
1986 /// versions of `value()` are not provided because `NullableValue` does
1987 /// not require them.
1988 const t_TYPE& dereferenceRaw() const;
1989# endif // BDE_OMIT_INTERNAL_DEPRECATED
1990
1991 public:
1992 // TRAITS
1994 BloombergLP::bslma::UsesBslmaAllocator);
1996 BloombergLP::bslmf::UsesAllocatorArgT);
1999 BloombergLP::bslmf::IsBitwiseMoveable,
2000 BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
2003 BloombergLP::bslmf::IsBitwiseCopyable,
2004 BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
2005
2006 // MANIPULATORS
2007#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2008// {{{ BEGIN GENERATED CODE
2009// Command line: sim_cpp11_features.pl bslstl_optional.h
2010#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
2011#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
2012#endif
2013#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_D
2014#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_D BSLSTL_OPTIONAL_VARIADIC_LIMIT
2015#endif
2016#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0
2017 t_TYPE& emplace();
2018#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0
2019
2020#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1
2021 template <class t_ARGS_01>
2022 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
2023#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1
2024
2025#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2
2026 template <class t_ARGS_01,
2027 class t_ARGS_02>
2028 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2029 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
2030#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2
2031
2032#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3
2033 template <class t_ARGS_01,
2034 class t_ARGS_02,
2035 class t_ARGS_03>
2036 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2037 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2038 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
2039#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3
2040
2041#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4
2042 template <class t_ARGS_01,
2043 class t_ARGS_02,
2044 class t_ARGS_03,
2045 class t_ARGS_04>
2046 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2047 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2048 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2049 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
2050#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4
2051
2052#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5
2053 template <class t_ARGS_01,
2054 class t_ARGS_02,
2055 class t_ARGS_03,
2056 class t_ARGS_04,
2057 class t_ARGS_05>
2058 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2059 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2060 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2061 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2062 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
2063#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5
2064
2065#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6
2066 template <class t_ARGS_01,
2067 class t_ARGS_02,
2068 class t_ARGS_03,
2069 class t_ARGS_04,
2070 class t_ARGS_05,
2071 class t_ARGS_06>
2072 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2073 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2074 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2075 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2076 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2077 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
2078#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6
2079
2080#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7
2081 template <class t_ARGS_01,
2082 class t_ARGS_02,
2083 class t_ARGS_03,
2084 class t_ARGS_04,
2085 class t_ARGS_05,
2086 class t_ARGS_06,
2087 class t_ARGS_07>
2088 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2089 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2090 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2091 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2092 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2093 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2094 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
2095#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7
2096
2097#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8
2098 template <class t_ARGS_01,
2099 class t_ARGS_02,
2100 class t_ARGS_03,
2101 class t_ARGS_04,
2102 class t_ARGS_05,
2103 class t_ARGS_06,
2104 class t_ARGS_07,
2105 class t_ARGS_08>
2106 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2107 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2108 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2109 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2110 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2111 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2112 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2113 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
2114#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8
2115
2116#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9
2117 template <class t_ARGS_01,
2118 class t_ARGS_02,
2119 class t_ARGS_03,
2120 class t_ARGS_04,
2121 class t_ARGS_05,
2122 class t_ARGS_06,
2123 class t_ARGS_07,
2124 class t_ARGS_08,
2125 class t_ARGS_09>
2126 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2127 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2128 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2129 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2130 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2131 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2132 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2133 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
2134 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
2135#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9
2136
2137#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10
2138 template <class t_ARGS_01,
2139 class t_ARGS_02,
2140 class t_ARGS_03,
2141 class t_ARGS_04,
2142 class t_ARGS_05,
2143 class t_ARGS_06,
2144 class t_ARGS_07,
2145 class t_ARGS_08,
2146 class t_ARGS_09,
2147 class t_ARGS_10>
2148 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2149 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2150 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2151 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2152 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2153 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2154 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2155 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
2156 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
2157 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
2158#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10
2159
2160
2161# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2162#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0
2163 template <class t_INIT_LIST_TYPE>
2164 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il);
2165#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0
2166
2167#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1
2168 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
2169 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2170 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
2171#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1
2172
2173#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2
2174 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2175 class t_ARGS_02>
2176 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2177 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2178 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
2179#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2
2180
2181#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3
2182 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2183 class t_ARGS_02,
2184 class t_ARGS_03>
2185 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2186 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2187 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2188 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
2189#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3
2190
2191#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4
2192 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2193 class t_ARGS_02,
2194 class t_ARGS_03,
2195 class t_ARGS_04>
2196 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2197 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2198 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2199 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2200 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
2201#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4
2202
2203#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5
2204 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2205 class t_ARGS_02,
2206 class t_ARGS_03,
2207 class t_ARGS_04,
2208 class t_ARGS_05>
2209 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2210 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2211 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2212 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2213 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2214 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
2215#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5
2216
2217#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6
2218 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2219 class t_ARGS_02,
2220 class t_ARGS_03,
2221 class t_ARGS_04,
2222 class t_ARGS_05,
2223 class t_ARGS_06>
2224 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2225 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2226 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2227 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2228 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2229 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2230 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
2231#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6
2232
2233#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7
2234 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2235 class t_ARGS_02,
2236 class t_ARGS_03,
2237 class t_ARGS_04,
2238 class t_ARGS_05,
2239 class t_ARGS_06,
2240 class t_ARGS_07>
2241 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2242 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2243 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2244 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2245 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2246 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2247 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2248 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
2249#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7
2250
2251#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8
2252 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2253 class t_ARGS_02,
2254 class t_ARGS_03,
2255 class t_ARGS_04,
2256 class t_ARGS_05,
2257 class t_ARGS_06,
2258 class t_ARGS_07,
2259 class t_ARGS_08>
2260 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2261 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2262 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2263 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2264 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2265 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2266 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2267 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2268 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
2269#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8
2270
2271#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9
2272 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2273 class t_ARGS_02,
2274 class t_ARGS_03,
2275 class t_ARGS_04,
2276 class t_ARGS_05,
2277 class t_ARGS_06,
2278 class t_ARGS_07,
2279 class t_ARGS_08,
2280 class t_ARGS_09>
2281 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2282 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2283 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2284 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2285 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2286 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2287 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2288 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2289 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
2290 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
2291#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9
2292
2293#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10
2294 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2295 class t_ARGS_02,
2296 class t_ARGS_03,
2297 class t_ARGS_04,
2298 class t_ARGS_05,
2299 class t_ARGS_06,
2300 class t_ARGS_07,
2301 class t_ARGS_08,
2302 class t_ARGS_09,
2303 class t_ARGS_10>
2304 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2305 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2306 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2307 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2308 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2309 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2310 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2311 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2312 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
2313 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
2314 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
2315#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10
2316
2317
2318# endif
2319#else
2320// The generated code below is a workaround for the absence of perfect
2321// forwarding in some compilers.
2322 template <class... t_ARGS>
2323 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
2324
2325# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2326 template <class t_INIT_LIST_TYPE, class... t_ARGS>
2327 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
2328 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
2329
2330# endif
2331// }}} END GENERATED CODE
2332#endif
2333 /// Reset this object to the default constructed state (i.e., to a
2334 /// disengaged state).
2336
2338 bsl::is_nothrow_move_constructible<t_TYPE>::value &&
2339 bsl::is_nothrow_swappable<t_TYPE>::value);
2340 // Efficiently exchange the value of this object with the value of the
2341 // specified 'other' object. This method provides the no-throw
2342 // exception-safety guarantee if the template parameter 't_TYPE'
2343 // provides that guarantee and the result of the 'hasValue' method for
2344 // the two objects being swapped is the same. The behavior is
2345 // undefined unless this object was created with the same allocator as
2346 // 'other'.
2347
2348# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2349 /// Return a reference providing modifiable access to the underlying
2350 /// `t_TYPE` object if `true == has_value()` and throw
2351 /// `bsl::bad_optional_access` otherwise.
2352 t_TYPE& value() &;
2353 t_TYPE&& value() &&;
2354# else
2355 t_TYPE& value();
2356 // Return a reference providing modifiable access to the underlying
2357 // 't_TYPE' object. Throws a 'bsl::bad_optional_access' if the
2358 // 'Optional_Base' object is disengaged.
2359# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
2360
2361# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2362 /// Return a copy of the underlying object of a (template parameter)
2363 /// `t_TYPE` if this object is non-null, and the specified `value`
2364 /// converted to `t_TYPE` otherwise. Note that this method returns *by*
2365 /// *value*, so may be inefficient in some contexts.
2366 template <class t_ANY_TYPE>
2367 t_TYPE value_or(t_ANY_TYPE&& value) &&;
2368# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2369 /// If this object is non-null, return a copy of the underlying object
2370 /// of a (template parameter) `t_TYPE` created using the provided
2371 /// allocator, and the specified `value` converted to `t_TYPE` using the
2372 /// specified `allocator` otherwise. Note that this method returns *by*
2373 /// *value*, so may be inefficient in some contexts.
2374 template <class t_ANY_TYPE>
2375 t_TYPE value_or(bsl::allocator_arg_t,
2377 t_ANY_TYPE&& value) &&;
2378# endif // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2379# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2380
2381 /// Assign to this object the value of the specified `rhs` object, and
2382 /// return a non-`const` reference to this object.
2384
2385 /// Assign to this object the value of the specified `rhs` object, and
2386 /// return a non-`const` reference to this object. The allocators of
2387 /// this object and `rhs` both remain unchanged. The contents of `rhs`
2388 /// are either move-constructed into or move-assigned to this object.
2389 /// `rhs` is left in a valid but unspecified state.
2391 BloombergLP::bslmf::MovableRef<Optional_Base> rhs);
2392
2393 /// Return a pointer providing modifiable access to the underlying
2394 /// `t_TYPE` object. The behavior is undefined if the `Optional_Base`
2395 /// object is disengaged.
2396 t_TYPE *operator->();
2397
2398# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2399 /// Return a reference providing modifiable access to the underlying
2400 /// `t_TYPE` object. The behavior is undefined if the `Optional_Base`
2401 /// object is disengaged.
2402 t_TYPE& operator*() &;
2403 t_TYPE&& operator*() &&;
2404# else
2405 t_TYPE& operator*();
2406 // Return a reference providing modifiable access to the underlying
2407 // 't_TYPE' object. The behavior is undefined if the 'Optional_Base'
2408 // object is disengaged.
2409
2410# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
2411
2412 // ACCESSORS
2413
2414 /// Return allocator used for construction of `value_type`.
2416
2417 /// Return `false` if this object is disengaged, and `true` otherwise.
2418 bool has_value() const BSLS_KEYWORD_NOEXCEPT;
2419
2420# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2421 /// Return a reference providing non-modifiable access to the underlying
2422 /// `t_TYPE` object if `true == has_value()` and throw
2423 /// `bsl::bad_optional_access` otherwise.
2424 const t_TYPE& value() const &;
2425 const t_TYPE&& value() const &&;
2426# else
2427
2428 const t_TYPE& value() const;
2429 // Return a reference providing non-modifiable access to the underlying
2430 // 't_TYPE' object. Throws a 'bsl::bad_optional_access' if the
2431 // 'Optional_Base' object is disengaged.
2432
2433# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
2434
2435 /// Return a pointer providing non-modifiable access to the underlying
2436 /// `t_TYPE` object. The behavior is undefined if the `Optional_Base`
2437 /// object is disengaged.
2438 const t_TYPE *operator->() const;
2439
2440# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2441
2442 /// Return a reference providing non-modifiable access to the underlying
2443 /// `t_TYPE` object. The behavior is undefined if the `Optional_Base`
2444 /// object is disengaged.
2445 const t_TYPE& operator*() const &;
2446 const t_TYPE&& operator*() const &&;
2447
2448# else
2449
2450 const t_TYPE& operator*() const;
2451 // Return a reference providing non-modifiable access to the underlying
2452 // 't_TYPE' object. The behavior is undefined if the 'Optional_Base'
2453 // object is disengaged.
2454
2455# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
2456
2457# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
2458 /// Return a copy of the underlying object of a (template parameter)
2459 /// `t_TYPE` if this object is non-null, and the specified `value`
2460 /// converted to `t_TYPE` otherwise. Note that this method returns *by*
2461 /// *value*, so may be inefficient in some contexts.
2462 template <class t_ANY_TYPE>
2463 t_TYPE value_or(
2464 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&;
2465# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2466 /// If this object is non-null, return a copy of the underlying object
2467 /// of a (template parameter) `t_TYPE` created using the provided
2468 /// allocator, and the specified `value` converted to `t_TYPE` using the
2469 /// specified `allocator` otherwise. Note that this method returns *by*
2470 /// *value*, so may be inefficient in some contexts.
2471 template <class t_ANY_TYPE>
2472 t_TYPE value_or(
2473 bsl::allocator_arg_t,
2475 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&;
2476# endif // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2477# else
2478 template <class t_ANY_TYPE>
2479 t_TYPE value_or(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const;
2480 // Return a copy of the underlying object of a (template parameter)
2481 // 't_TYPE' if this object is non-null, and the specified 'value'
2482 // converted to 't_TYPE' otherwise. Note that this method returns *by*
2483 // *value*, so may be inefficient in some contexts.
2484# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2485 template <class t_ANY_TYPE>
2486 t_TYPE value_or(bsl::allocator_arg_t,
2488 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const;
2489 // If this object is non-null, return a copy of the underlying object
2490 // of a (template parameter) 't_TYPE' created using the provided
2491 // allocator, and the specified 'value' converted to 't_TYPE' using the
2492 // specified 'allocator' otherwise. Note that this method returns *by*
2493 // *value*, so may be inefficient in some contexts.
2494# endif // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
2495# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
2496
2497#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
2498 /// Return `false` if this object is disengaged, and `true` otherwise.
2499 explicit operator bool() const BSLS_KEYWORD_NOEXCEPT;
2500#else
2501 // Simulation of explicit conversion to bool. Inlined to work around xlC
2502 // bug when out-of-line.
2503 operator UnspecifiedBool() const BSLS_NOTHROW_SPEC
2504 {
2505 return UnspecifiedBoolUtil::makeValue(has_value());
2506 }
2507#endif // BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT else
2508};
2509
2510// ============================================================================
2511// Section: Definition of C++17 Allocator-Unaware 'Optional_Base'
2512// ============================================================================
2513
2514 // ==================================
2515 // class Optional_Base<t_TYPE, false>
2516 // ==================================
2517
2518# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
2519/// Specialization of `Optional_Base` for `value_type` that is not
2520/// allocator-aware when `std::optional` is available.
2521template <class t_TYPE>
2522class Optional_Base<t_TYPE, false> : public std::optional<t_TYPE> {
2523
2524 private:
2525 // PRIVATE TYPES
2526 typedef std::optional<t_TYPE> StdOptionalBase;
2527
2528 protected:
2529 // PROTECTED TYPES
2530 struct AllocType {
2531 private:
2532 // NOT IMPLEMENTED
2533
2534 /// This constructor prevents `AllocType` from being an aggregate.
2535 explicit AllocType(int) = delete;
2536 };
2537
2538 // PROTECTED CREATORS
2539
2540 /// Create a disengaged `Optional_Base` object.
2541 Optional_Base();
2542
2543 /// Create a disengaged `Optional_Base` object.
2544 Optional_Base(bsl::nullopt_t); // IMPLICIT
2545
2546 /// Create an `Optional_Base` object whose contained value is
2547 /// initialized by forwarding from the specified `value`.
2548 template <class t_ANY_TYPE>
2549 Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
2550 t_ANY_TYPE&& value);
2551
2552 /// Create a disengaged `Optional_Base` object if the specified
2553 /// `original` object is disengaged, and an `Optional_Base` object with
2554 /// the value of `original.value()` (of `t_ANY_TYPE`) converted to
2555 /// `t_TYPE` otherwise.
2556 template <class t_ANY_TYPE>
2557 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
2558 const Optional_Base<t_ANY_TYPE>& original);
2559
2560 /// Create a disengaged `Optional_Base` object if the specified
2561 /// `original` object is disengaged, and an `Optional_Base` object with
2562 /// the value of `original.value()` (of `t_ANY_TYPE`) converted to
2563 /// `t_TYPE` otherwise. `original` is left in a valid but unspecified
2564 /// state.
2565 template <class t_ANY_TYPE>
2566 Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
2567 Optional_Base<t_ANY_TYPE>&& original);
2568
2569 template <class t_ANY_TYPE>
2570 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
2571 const std::optional<t_ANY_TYPE>& original);
2572
2573 template <class t_ANY_TYPE>
2574 Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
2575 std::optional<t_ANY_TYPE>&& original);
2576
2577 /// Create an `Optional_Base` object whose contained value is
2578 /// initialized from the specified `args`.
2579 template <class... t_ARGS>
2580 explicit Optional_Base(bsl::in_place_t, t_ARGS&&... args);
2581
2582 /// Create an `Optional_Base` object whose contained value is
2583 /// initialized from the specified `il` and `args`.
2584 template <class t_INIT_LIST_TYPE, class... t_ARGS>
2586 std::initializer_list<t_INIT_LIST_TYPE> il,
2587 t_ARGS&&... args);
2588
2589 // These allocator-extended constructors cannot be called, and are provided
2590 // only to prevent compilation errors when 'optional' is explicitly
2591 // instantiated.
2592
2593 Optional_Base(bsl::allocator_arg_t, AllocType);
2594
2595 Optional_Base(bsl::allocator_arg_t, AllocType, bsl::nullopt_t);
2596
2597 template <class t_ANY_TYPE>
2598 Optional_Base(bsl::allocator_arg_t,
2599 AllocType,
2600 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
2601 t_ANY_TYPE&&);
2602
2603 template <class t_ANY_TYPE>
2604 Optional_Base(bsl::allocator_arg_t,
2605 AllocType,
2606 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
2607 const Optional_Base<t_ANY_TYPE>&);
2608
2609 template <class t_ANY_TYPE>
2610 Optional_Base(bsl::allocator_arg_t,
2611 AllocType,
2612 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
2613 Optional_Base<t_ANY_TYPE>&&);
2614
2615 template <class t_ANY_TYPE>
2616 Optional_Base(bsl::allocator_arg_t,
2617 AllocType,
2618 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
2619 const std::optional<t_ANY_TYPE>&);
2620
2621 template <class t_ANY_TYPE>
2622 Optional_Base(bsl::allocator_arg_t,
2623 AllocType,
2624 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
2625 std::optional<t_ANY_TYPE>&&);
2626
2627 template <class... t_ARGS>
2628 Optional_Base(bsl::allocator_arg_t,
2629 AllocType,
2631 t_ARGS&&...);
2632
2633 template <class t_INIT_LIST_TYPE, class... t_ARGS>
2634 Optional_Base(bsl::allocator_arg_t,
2635 AllocType,
2637 std::initializer_list<t_INIT_LIST_TYPE>,
2638 t_ARGS&&...);
2639
2640 // PROTECTED MANIPULATORS
2641
2642 /// If `*this` holds an object, assign to that object the value of the
2643 /// specified `rhs`, converted to `t_TYPE`. Otherwise, construct a held
2644 /// object from `rhs`, converted to `t_TYPE`.
2645 template <class t_ANY_TYPE>
2646 void assignOrEmplace(t_ANY_TYPE&& rhs);
2647
2648# ifndef BDE_OMIT_INTERNAL_DEPRECATED
2649 /// Return a reference providing modifiable access to the underlying
2650 /// `t_TYPE` object. The behavior is undefined if the `Optional_Base`
2651 /// object is disengaged. Note that this function is only intended to
2652 /// be called by `bdlb::NullableValue::value` during transition of its
2653 /// implementation to use 'bsl::Optional_Base. Note that ref-qualified
2654 /// versions of `value()` are not provided because `NullableValue` does
2655 /// not require them.
2656 t_TYPE& dereferenceRaw();
2657
2658 // PROTECTED ACCESSORS
2659
2660 /// Return a reference providing non-modifiable access to the underlying
2661 /// `t_TYPE` object. The behavior is undefined if the `Optional_Base`
2662 /// object is disengaged. Note that this function is only intended to
2663 /// be called by `bdlb::NullableValue::value` during transition of its
2664 /// implementation to use 'bsl::Optional_Base. Note that ref-qualified
2665 /// versions of `value()` are not provided because `NullableValue` does
2666 /// not require them.
2667 const t_TYPE& dereferenceRaw() const;
2668# endif // BDE_OMIT_INTERNAL_DEPRECATED
2669
2670 public:
2671 // TRAITS
2674 BloombergLP::bslmf::IsBitwiseMoveable,
2675 BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
2678 BloombergLP::bslmf::IsBitwiseCopyable,
2679 BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
2680};
2681# else // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
2682
2683// ============================================================================
2684// Section: Definition of Pre-C++17 Allocator-Unaware 'Optional_Base'
2685// ============================================================================
2686
2687 // ==================================
2688 // class Optional_Base<t_TYPE, false>
2689 // ==================================
2690
2691template <class t_TYPE>
2692class Optional_Base<t_TYPE, false> {
2693 // Specialization of 'Optional_Base' for 'value_type' that is not
2694 // allocator-aware.
2695
2696 private:
2697 // PRIVATE TYPES
2698 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
2699
2700# ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
2701 // UNSPECIFIED BOOL
2702
2703 // This type is needed only in C++03 mode, where 'explicit' conversion
2704 // operators are not supported. An 'optional' object is contextually
2705 // converted to 'UnspecifiedBool' when used in 'if' statements, but is not
2706 // implicitly convertible to 'bool'.
2707 typedef BloombergLP::bsls::UnspecifiedBool<Optional_Base>
2708 UnspecifiedBoolUtil;
2709 typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
2710# endif
2711
2712 // DATA
2713 BloombergLP::bslstl::Optional_Data<t_TYPE> d_value;
2714 // in-place 'TYPE' object
2715
2716 protected:
2717 // PROTECTED TYPES
2718 struct AllocType {
2719 private:
2720 // NOT IMPLEMENTED
2721 explicit AllocType(int) BSLS_KEYWORD_DELETED;
2722 // This constructor prevents 'AllocType' from being an aggregate.
2723 };
2724
2725 // PROTECTED CREATORS
2726 Optional_Base();
2727 // Create a disengaged 'Optional_Base' object.
2728
2729 Optional_Base(bsl::nullopt_t); // IMPLICIT
2730 // Create a disengaged 'Optional_Base' object.
2731
2732 Optional_Base(const Optional_Base& original);
2733 // Create an 'Optional_Base' object having the value of the specified
2734 // 'original' object.
2735
2736 Optional_Base(BloombergLP::bslmf::MovableRef<Optional_Base> original)
2739 // Create an 'Optional_Base' object having the same value as the
2740 // specified 'original' object by moving the contents of 'original' to
2741 // the newly-created object. 'original' is left in a valid, but
2742 // unspecified state.
2743
2744 template <class t_ANY_TYPE>
2745 Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
2747 // Create an 'Optional_Base' object whose contained value is
2748 // initialized by forwarding from the specified 'value'.
2749
2750 template <class t_ANY_TYPE>
2751 Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
2752 const Optional_Base<t_ANY_TYPE>& original);
2753 // Create a disengaged 'Optional_Base' object if the specified
2754 // 'original' object is disengaged, and an 'Optional_Base' object with
2755 // the value of 'original.value()' converted to 't_TYPE' otherwise.
2756
2757 template <class t_ANY_TYPE>
2758 Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
2759 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original);
2760 // Create a disengaged 'Optional_Base' object if the specified
2761 // 'original' object is disengaged, and an 'Optional_Base' object with
2762 // the value of 'original.value()' converted to 't_TYPE' otherwise.
2763 // 'original' is left in a valid but unspecified state.
2764
2765#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2766// {{{ BEGIN GENERATED CODE
2767// Command line: sim_cpp11_features.pl bslstl_optional.h
2768#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
2769#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
2770#endif
2771#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_E
2772#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_E BSLSTL_OPTIONAL_VARIADIC_LIMIT
2773#endif
2774#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0
2776#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0
2777
2778#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1
2779 template <class t_ARGS_01>
2781 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
2782#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1
2783
2784#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2
2785 template <class t_ARGS_01,
2786 class t_ARGS_02>
2788 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2789 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
2790#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2
2791
2792#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3
2793 template <class t_ARGS_01,
2794 class t_ARGS_02,
2795 class t_ARGS_03>
2797 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2798 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2799 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
2800#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3
2801
2802#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4
2803 template <class t_ARGS_01,
2804 class t_ARGS_02,
2805 class t_ARGS_03,
2806 class t_ARGS_04>
2808 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2809 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2810 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2811 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
2812#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4
2813
2814#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5
2815 template <class t_ARGS_01,
2816 class t_ARGS_02,
2817 class t_ARGS_03,
2818 class t_ARGS_04,
2819 class t_ARGS_05>
2821 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2822 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2823 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2824 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2825 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
2826#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5
2827
2828#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6
2829 template <class t_ARGS_01,
2830 class t_ARGS_02,
2831 class t_ARGS_03,
2832 class t_ARGS_04,
2833 class t_ARGS_05,
2834 class t_ARGS_06>
2836 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2837 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2838 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2839 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2840 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2841 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
2842#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6
2843
2844#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7
2845 template <class t_ARGS_01,
2846 class t_ARGS_02,
2847 class t_ARGS_03,
2848 class t_ARGS_04,
2849 class t_ARGS_05,
2850 class t_ARGS_06,
2851 class t_ARGS_07>
2853 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2854 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2855 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2856 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2857 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2858 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2859 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
2860#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7
2861
2862#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8
2863 template <class t_ARGS_01,
2864 class t_ARGS_02,
2865 class t_ARGS_03,
2866 class t_ARGS_04,
2867 class t_ARGS_05,
2868 class t_ARGS_06,
2869 class t_ARGS_07,
2870 class t_ARGS_08>
2872 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2873 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2874 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2875 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2876 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2877 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2878 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2879 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
2880#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8
2881
2882#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9
2883 template <class t_ARGS_01,
2884 class t_ARGS_02,
2885 class t_ARGS_03,
2886 class t_ARGS_04,
2887 class t_ARGS_05,
2888 class t_ARGS_06,
2889 class t_ARGS_07,
2890 class t_ARGS_08,
2891 class t_ARGS_09>
2893 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2894 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2895 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2896 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2897 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2898 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2899 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2900 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
2901 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
2902#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9
2903
2904#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10
2905 template <class t_ARGS_01,
2906 class t_ARGS_02,
2907 class t_ARGS_03,
2908 class t_ARGS_04,
2909 class t_ARGS_05,
2910 class t_ARGS_06,
2911 class t_ARGS_07,
2912 class t_ARGS_08,
2913 class t_ARGS_09,
2914 class t_ARGS_10>
2916 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2917 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2918 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2919 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2920 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
2921 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
2922 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
2923 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
2924 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
2925 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
2926#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10
2927
2928
2929# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2930#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0
2931 template <class t_INIT_LIST_TYPE>
2933 std::initializer_list<t_INIT_LIST_TYPE> il);
2934#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0
2935
2936#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1
2937 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
2939 std::initializer_list<t_INIT_LIST_TYPE> il,
2940 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
2941#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1
2942
2943#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2
2944 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2945 class t_ARGS_02>
2947 std::initializer_list<t_INIT_LIST_TYPE> il,
2948 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2949 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
2950#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2
2951
2952#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3
2953 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2954 class t_ARGS_02,
2955 class t_ARGS_03>
2957 std::initializer_list<t_INIT_LIST_TYPE> il,
2958 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2959 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2960 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
2961#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3
2962
2963#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4
2964 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2965 class t_ARGS_02,
2966 class t_ARGS_03,
2967 class t_ARGS_04>
2969 std::initializer_list<t_INIT_LIST_TYPE> il,
2970 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2971 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2972 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2973 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
2974#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4
2975
2976#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5
2977 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2978 class t_ARGS_02,
2979 class t_ARGS_03,
2980 class t_ARGS_04,
2981 class t_ARGS_05>
2983 std::initializer_list<t_INIT_LIST_TYPE> il,
2984 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
2985 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
2986 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
2987 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
2988 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
2989#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5
2990
2991#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6
2992 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
2993 class t_ARGS_02,
2994 class t_ARGS_03,
2995 class t_ARGS_04,
2996 class t_ARGS_05,
2997 class t_ARGS_06>
2999 std::initializer_list<t_INIT_LIST_TYPE> il,
3000 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3001 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3002 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3003 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3004 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3005 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
3006#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6
3007
3008#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7
3009 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3010 class t_ARGS_02,
3011 class t_ARGS_03,
3012 class t_ARGS_04,
3013 class t_ARGS_05,
3014 class t_ARGS_06,
3015 class t_ARGS_07>
3017 std::initializer_list<t_INIT_LIST_TYPE> il,
3018 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3019 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3020 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3021 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3022 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3023 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3024 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
3025#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7
3026
3027#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8
3028 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3029 class t_ARGS_02,
3030 class t_ARGS_03,
3031 class t_ARGS_04,
3032 class t_ARGS_05,
3033 class t_ARGS_06,
3034 class t_ARGS_07,
3035 class t_ARGS_08>
3037 std::initializer_list<t_INIT_LIST_TYPE> il,
3038 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3039 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3040 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3041 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3042 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3043 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3044 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3045 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
3046#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8
3047
3048#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9
3049 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3050 class t_ARGS_02,
3051 class t_ARGS_03,
3052 class t_ARGS_04,
3053 class t_ARGS_05,
3054 class t_ARGS_06,
3055 class t_ARGS_07,
3056 class t_ARGS_08,
3057 class t_ARGS_09>
3059 std::initializer_list<t_INIT_LIST_TYPE> il,
3060 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3061 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3062 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3063 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3064 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3065 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3066 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3067 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
3068 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
3069#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9
3070
3071#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10
3072 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3073 class t_ARGS_02,
3074 class t_ARGS_03,
3075 class t_ARGS_04,
3076 class t_ARGS_05,
3077 class t_ARGS_06,
3078 class t_ARGS_07,
3079 class t_ARGS_08,
3080 class t_ARGS_09,
3081 class t_ARGS_10>
3083 std::initializer_list<t_INIT_LIST_TYPE> il,
3084 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3085 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3086 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3087 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3088 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3089 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3090 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3091 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
3092 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
3093 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
3094#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10
3095
3096# endif
3097#else
3098// The generated code below is a workaround for the absence of perfect
3099// forwarding in some compilers.
3100 template <class... t_ARGS>
3102 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
3103
3104# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3105 template <class t_INIT_LIST_TYPE, class... t_ARGS>
3107 std::initializer_list<t_INIT_LIST_TYPE> il,
3108 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
3109# endif
3110// }}} END GENERATED CODE
3111#endif
3112
3113 // These allocator-extended constructors cannot be called, and are provided
3114 // only to prevent compilation errors when 'optional' is explicitly
3115 // instantiated.
3116 Optional_Base(bsl::allocator_arg_t, AllocType);
3117
3118 Optional_Base(bsl::allocator_arg_t, AllocType, bsl::nullopt_t);
3119
3120 Optional_Base(bsl::allocator_arg_t, AllocType, const Optional_Base&);
3121
3122 Optional_Base(bsl::allocator_arg_t,
3123 AllocType,
3124 BloombergLP::bslmf::MovableRef<Optional_Base>);
3125
3126 template <class t_ANY_TYPE>
3127 Optional_Base(bsl::allocator_arg_t,
3128 AllocType,
3129 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
3131
3132 template <class t_ANY_TYPE>
3133 Optional_Base(bsl::allocator_arg_t,
3134 AllocType,
3135 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
3136 const Optional_Base<t_ANY_TYPE>&);
3137
3138 template <class t_ANY_TYPE>
3139 Optional_Base(bsl::allocator_arg_t,
3140 AllocType,
3141 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
3142 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>));
3143
3144#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
3145// {{{ BEGIN GENERATED CODE
3146// Command line: sim_cpp11_features.pl bslstl_optional.h
3147#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
3148#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
3149#endif
3150#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_F
3151#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_F BSLSTL_OPTIONAL_VARIADIC_LIMIT
3152#endif
3153#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0
3154 Optional_Base(bsl::allocator_arg_t,
3155 AllocType,
3157#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0
3158
3159#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1
3160 template <class t_ARGS_01>
3161 Optional_Base(bsl::allocator_arg_t,
3162 AllocType,
3165#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1
3166
3167#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2
3168 template <class t_ARGS_01,
3169 class t_ARGS_02>
3170 Optional_Base(bsl::allocator_arg_t,
3171 AllocType,
3175#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2
3176
3177#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3
3178 template <class t_ARGS_01,
3179 class t_ARGS_02,
3180 class t_ARGS_03>
3181 Optional_Base(bsl::allocator_arg_t,
3182 AllocType,
3187#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3
3188
3189#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4
3190 template <class t_ARGS_01,
3191 class t_ARGS_02,
3192 class t_ARGS_03,
3193 class t_ARGS_04>
3194 Optional_Base(bsl::allocator_arg_t,
3195 AllocType,
3201#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4
3202
3203#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5
3204 template <class t_ARGS_01,
3205 class t_ARGS_02,
3206 class t_ARGS_03,
3207 class t_ARGS_04,
3208 class t_ARGS_05>
3209 Optional_Base(bsl::allocator_arg_t,
3210 AllocType,
3217#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5
3218
3219#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6
3220 template <class t_ARGS_01,
3221 class t_ARGS_02,
3222 class t_ARGS_03,
3223 class t_ARGS_04,
3224 class t_ARGS_05,
3225 class t_ARGS_06>
3226 Optional_Base(bsl::allocator_arg_t,
3227 AllocType,
3235#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6
3236
3237#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7
3238 template <class t_ARGS_01,
3239 class t_ARGS_02,
3240 class t_ARGS_03,
3241 class t_ARGS_04,
3242 class t_ARGS_05,
3243 class t_ARGS_06,
3244 class t_ARGS_07>
3245 Optional_Base(bsl::allocator_arg_t,
3246 AllocType,
3255#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7
3256
3257#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8
3258 template <class t_ARGS_01,
3259 class t_ARGS_02,
3260 class t_ARGS_03,
3261 class t_ARGS_04,
3262 class t_ARGS_05,
3263 class t_ARGS_06,
3264 class t_ARGS_07,
3265 class t_ARGS_08>
3266 Optional_Base(bsl::allocator_arg_t,
3267 AllocType,
3277#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8
3278
3279#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9
3280 template <class t_ARGS_01,
3281 class t_ARGS_02,
3282 class t_ARGS_03,
3283 class t_ARGS_04,
3284 class t_ARGS_05,
3285 class t_ARGS_06,
3286 class t_ARGS_07,
3287 class t_ARGS_08,
3288 class t_ARGS_09>
3289 Optional_Base(bsl::allocator_arg_t,
3290 AllocType,
3301#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9
3302
3303#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10
3304 template <class t_ARGS_01,
3305 class t_ARGS_02,
3306 class t_ARGS_03,
3307 class t_ARGS_04,
3308 class t_ARGS_05,
3309 class t_ARGS_06,
3310 class t_ARGS_07,
3311 class t_ARGS_08,
3312 class t_ARGS_09,
3313 class t_ARGS_10>
3314 Optional_Base(bsl::allocator_arg_t,
3315 AllocType,
3327#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10
3328
3329
3330# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3331#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0
3332 template <class t_INIT_LIST_TYPE>
3333 Optional_Base(bsl::allocator_arg_t,
3334 AllocType,
3336 std::initializer_list<t_INIT_LIST_TYPE>);
3337#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0
3338
3339#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1
3340 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
3341 Optional_Base(bsl::allocator_arg_t,
3342 AllocType,
3344 std::initializer_list<t_INIT_LIST_TYPE>,
3346#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1
3347
3348#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2
3349 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3350 class t_ARGS_02>
3351 Optional_Base(bsl::allocator_arg_t,
3352 AllocType,
3354 std::initializer_list<t_INIT_LIST_TYPE>,
3357#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2
3358
3359#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3
3360 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3361 class t_ARGS_02,
3362 class t_ARGS_03>
3363 Optional_Base(bsl::allocator_arg_t,
3364 AllocType,
3366 std::initializer_list<t_INIT_LIST_TYPE>,
3370#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3
3371
3372#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4
3373 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3374 class t_ARGS_02,
3375 class t_ARGS_03,
3376 class t_ARGS_04>
3377 Optional_Base(bsl::allocator_arg_t,
3378 AllocType,
3380 std::initializer_list<t_INIT_LIST_TYPE>,
3385#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4
3386
3387#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5
3388 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3389 class t_ARGS_02,
3390 class t_ARGS_03,
3391 class t_ARGS_04,
3392 class t_ARGS_05>
3393 Optional_Base(bsl::allocator_arg_t,
3394 AllocType,
3396 std::initializer_list<t_INIT_LIST_TYPE>,
3402#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5
3403
3404#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6
3405 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3406 class t_ARGS_02,
3407 class t_ARGS_03,
3408 class t_ARGS_04,
3409 class t_ARGS_05,
3410 class t_ARGS_06>
3411 Optional_Base(bsl::allocator_arg_t,
3412 AllocType,
3414 std::initializer_list<t_INIT_LIST_TYPE>,
3421#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6
3422
3423#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7
3424 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3425 class t_ARGS_02,
3426 class t_ARGS_03,
3427 class t_ARGS_04,
3428 class t_ARGS_05,
3429 class t_ARGS_06,
3430 class t_ARGS_07>
3431 Optional_Base(bsl::allocator_arg_t,
3432 AllocType,
3434 std::initializer_list<t_INIT_LIST_TYPE>,
3442#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7
3443
3444#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8
3445 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3446 class t_ARGS_02,
3447 class t_ARGS_03,
3448 class t_ARGS_04,
3449 class t_ARGS_05,
3450 class t_ARGS_06,
3451 class t_ARGS_07,
3452 class t_ARGS_08>
3453 Optional_Base(bsl::allocator_arg_t,
3454 AllocType,
3456 std::initializer_list<t_INIT_LIST_TYPE>,
3465#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8
3466
3467#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9
3468 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3469 class t_ARGS_02,
3470 class t_ARGS_03,
3471 class t_ARGS_04,
3472 class t_ARGS_05,
3473 class t_ARGS_06,
3474 class t_ARGS_07,
3475 class t_ARGS_08,
3476 class t_ARGS_09>
3477 Optional_Base(bsl::allocator_arg_t,
3478 AllocType,
3480 std::initializer_list<t_INIT_LIST_TYPE>,
3490#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9
3491
3492#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10
3493 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3494 class t_ARGS_02,
3495 class t_ARGS_03,
3496 class t_ARGS_04,
3497 class t_ARGS_05,
3498 class t_ARGS_06,
3499 class t_ARGS_07,
3500 class t_ARGS_08,
3501 class t_ARGS_09,
3502 class t_ARGS_10>
3503 Optional_Base(bsl::allocator_arg_t,
3504 AllocType,
3506 std::initializer_list<t_INIT_LIST_TYPE>,
3517#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10
3518
3519# endif
3520#else
3521// The generated code below is a workaround for the absence of perfect
3522// forwarding in some compilers.
3523 template <class... t_ARGS>
3524 Optional_Base(bsl::allocator_arg_t,
3525 AllocType,
3528
3529# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3530 template <class t_INIT_LIST_TYPE, class... t_ARGS>
3531 Optional_Base(bsl::allocator_arg_t,
3532 AllocType,
3534 std::initializer_list<t_INIT_LIST_TYPE>,
3536# endif
3537// }}} END GENERATED CODE
3538#endif
3539
3540 // PROTECTED MANIPULATORS
3541 template <class t_ANY_TYPE>
3543 // If '*this' holds an object, assign to that object the value of
3544 // 'rhs', converted to 't_TYPE'. Otherwise, construct a held object
3545 // from 'rhs', converted to 't_TYPE'.
3546
3547# ifndef BDE_OMIT_INTERNAL_DEPRECATED
3548 t_TYPE& dereferenceRaw();
3549 // Return a reference providing modifiable access to the underlying
3550 // 't_TYPE' object. The behavior is undefined if the 'Optional_Base'
3551 // object is disengaged. Note that this function is only intended to
3552 // be called by 'bdlb::NullableValue::value' during transition of its
3553 // implementation to use 'bsl::Optional_Base. Note that ref-qualified
3554 // versions of 'value()' are not provided because 'NullableValue' does
3555 // not require them.
3556
3557 // PROTECTED ACCESSORS
3558 const t_TYPE& dereferenceRaw() const;
3559 // Return a reference providing non-modifiable access to the underlying
3560 // 't_TYPE' object. The behavior is undefined if the 'Optional_Base'
3561 // object is disengaged. Note that this function is only intended to
3562 // be called by 'bdlb::NullableValue::value' during transition of its
3563 // implementation to use 'bsl::Optional_Base. Note that ref-qualified
3564 // versions of 'value()' are not provided because 'NullableValue' does
3565 // not require them.
3566# endif // !BDE_OMIT_INTERNAL_DEPRECATED
3567
3568 public:
3569 // TYPES
3570 typedef t_TYPE value_type;
3571 // 'value_type' is an alias for the underlying 't_TYPE' upon which this
3572 // template class is instantiated, and represents the type of the
3573 // managed object. The name is chosen so it is compatible with the
3574 // 'std::optional' implementation.
3575
3576 // TRAITS
3579 BloombergLP::bslmf::IsBitwiseMoveable,
3580 BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
3583 BloombergLP::bslmf::IsBitwiseCopyable,
3584 BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
3585
3586 // MANIPULATORS
3587#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
3588// {{{ BEGIN GENERATED CODE
3589// Command line: sim_cpp11_features.pl bslstl_optional.h
3590#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
3591#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
3592#endif
3593#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_G
3594#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_G BSLSTL_OPTIONAL_VARIADIC_LIMIT
3595#endif
3596#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0
3597 t_TYPE& emplace();
3598#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0
3599
3600#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1
3601 template <class t_ARGS_01>
3602 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
3603#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1
3604
3605#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2
3606 template <class t_ARGS_01,
3607 class t_ARGS_02>
3608 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3609 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
3610#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2
3611
3612#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3
3613 template <class t_ARGS_01,
3614 class t_ARGS_02,
3615 class t_ARGS_03>
3616 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3617 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3618 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
3619#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3
3620
3621#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4
3622 template <class t_ARGS_01,
3623 class t_ARGS_02,
3624 class t_ARGS_03,
3625 class t_ARGS_04>
3626 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3627 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3628 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3629 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
3630#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4
3631
3632#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5
3633 template <class t_ARGS_01,
3634 class t_ARGS_02,
3635 class t_ARGS_03,
3636 class t_ARGS_04,
3637 class t_ARGS_05>
3638 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3639 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3640 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3641 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3642 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
3643#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5
3644
3645#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6
3646 template <class t_ARGS_01,
3647 class t_ARGS_02,
3648 class t_ARGS_03,
3649 class t_ARGS_04,
3650 class t_ARGS_05,
3651 class t_ARGS_06>
3652 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3653 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3654 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3655 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3656 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3657 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
3658#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6
3659
3660#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7
3661 template <class t_ARGS_01,
3662 class t_ARGS_02,
3663 class t_ARGS_03,
3664 class t_ARGS_04,
3665 class t_ARGS_05,
3666 class t_ARGS_06,
3667 class t_ARGS_07>
3668 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3669 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3670 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3671 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3672 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3673 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3674 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
3675#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7
3676
3677#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8
3678 template <class t_ARGS_01,
3679 class t_ARGS_02,
3680 class t_ARGS_03,
3681 class t_ARGS_04,
3682 class t_ARGS_05,
3683 class t_ARGS_06,
3684 class t_ARGS_07,
3685 class t_ARGS_08>
3686 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3687 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3688 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3689 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3690 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3691 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3692 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3693 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
3694#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8
3695
3696#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9
3697 template <class t_ARGS_01,
3698 class t_ARGS_02,
3699 class t_ARGS_03,
3700 class t_ARGS_04,
3701 class t_ARGS_05,
3702 class t_ARGS_06,
3703 class t_ARGS_07,
3704 class t_ARGS_08,
3705 class t_ARGS_09>
3706 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3707 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3708 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3709 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3710 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3711 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3712 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3713 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
3714 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
3715#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9
3716
3717#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10
3718 template <class t_ARGS_01,
3719 class t_ARGS_02,
3720 class t_ARGS_03,
3721 class t_ARGS_04,
3722 class t_ARGS_05,
3723 class t_ARGS_06,
3724 class t_ARGS_07,
3725 class t_ARGS_08,
3726 class t_ARGS_09,
3727 class t_ARGS_10>
3728 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3729 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3730 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3731 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3732 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3733 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3734 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3735 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
3736 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
3737 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
3738#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10
3739
3740
3741# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3742#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0
3743 template <class t_INIT_LIST_TYPE>
3744 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il);
3745#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0
3746
3747#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1
3748 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
3749 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3750 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
3751#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1
3752
3753#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2
3754 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3755 class t_ARGS_02>
3756 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3757 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3758 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
3759#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2
3760
3761#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3
3762 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3763 class t_ARGS_02,
3764 class t_ARGS_03>
3765 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3766 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3767 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3768 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
3769#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3
3770
3771#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4
3772 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3773 class t_ARGS_02,
3774 class t_ARGS_03,
3775 class t_ARGS_04>
3776 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3777 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3778 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3779 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3780 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
3781#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4
3782
3783#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5
3784 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3785 class t_ARGS_02,
3786 class t_ARGS_03,
3787 class t_ARGS_04,
3788 class t_ARGS_05>
3789 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3790 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3791 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3792 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3793 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3794 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
3795#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5
3796
3797#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6
3798 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3799 class t_ARGS_02,
3800 class t_ARGS_03,
3801 class t_ARGS_04,
3802 class t_ARGS_05,
3803 class t_ARGS_06>
3804 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3805 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3806 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3807 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3808 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3809 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3810 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
3811#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6
3812
3813#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7
3814 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3815 class t_ARGS_02,
3816 class t_ARGS_03,
3817 class t_ARGS_04,
3818 class t_ARGS_05,
3819 class t_ARGS_06,
3820 class t_ARGS_07>
3821 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3822 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3823 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3824 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3825 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3826 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3827 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3828 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
3829#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7
3830
3831#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8
3832 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3833 class t_ARGS_02,
3834 class t_ARGS_03,
3835 class t_ARGS_04,
3836 class t_ARGS_05,
3837 class t_ARGS_06,
3838 class t_ARGS_07,
3839 class t_ARGS_08>
3840 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3841 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3842 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3843 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3844 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3845 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3846 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3847 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3848 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
3849#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8
3850
3851#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9
3852 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3853 class t_ARGS_02,
3854 class t_ARGS_03,
3855 class t_ARGS_04,
3856 class t_ARGS_05,
3857 class t_ARGS_06,
3858 class t_ARGS_07,
3859 class t_ARGS_08,
3860 class t_ARGS_09>
3861 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3862 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3863 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3864 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3865 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3866 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3867 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3868 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3869 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
3870 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
3871#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9
3872
3873#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10
3874 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
3875 class t_ARGS_02,
3876 class t_ARGS_03,
3877 class t_ARGS_04,
3878 class t_ARGS_05,
3879 class t_ARGS_06,
3880 class t_ARGS_07,
3881 class t_ARGS_08,
3882 class t_ARGS_09,
3883 class t_ARGS_10>
3884 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3885 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
3886 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
3887 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
3888 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
3889 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
3890 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
3891 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
3892 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
3893 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
3894 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
3895#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10
3896
3897
3898# endif
3899#else
3900// The generated code below is a workaround for the absence of perfect
3901// forwarding in some compilers.
3902 template <class... t_ARGS>
3903 t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
3904
3905# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3906 template <class t_INIT_LIST_TYPE, class... t_ARGS>
3907 t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE> il,
3908 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
3909
3910# endif
3911// }}} END GENERATED CODE
3912#endif
3913
3915 // Reset this object to the default constructed state (i.e., to be in a
3916 // disengaged state).
3917
3919 bsl::is_nothrow_move_constructible<t_TYPE>::value &&
3920 bsl::is_nothrow_swappable<t_TYPE>::value);
3921 // Efficiently exchange the value of this object with the value of the
3922 // specified 'other' object. This method provides the no-throw
3923 // exception-safety guarantee if the template parameter 't_TYPE'
3924 // provides that guarantee and the result of the 'hasValue' method for
3925 // the two objects being swapped is the same.
3926
3927# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
3928 t_TYPE& value() &;
3929 t_TYPE&& value() &&;
3930 // Return a reference providing modifiable access to the underlying
3931 // 't_TYPE' object if 'true == has_value()' and throw
3932 // 'bsl::bad_optional_access' otherwise.
3933
3934# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
3935 t_TYPE& value();
3936 // Return a reference providing modifiable access to the underlying
3937 // 't_TYPE' object. Throws a 'bsl::bad_optional_access' if the
3938 // 'Optional_Base' object is disengaged.
3939
3940# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
3941
3942# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
3943 template <class t_ANY_TYPE>
3944 t_TYPE value_or(t_ANY_TYPE&& value) &&;
3945 // Return a copy of the underlying object of a (template parameter)
3946 // 't_TYPE' if this object is non-null, and the specified 'value'
3947 // converted to 't_TYPE' otherwise. Note that this method returns *by*
3948 // *value*, so may be inefficient in some contexts.
3949# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
3950
3952 // Assign to this object the value of the specified 'rhs' object, and
3953 // return a non-'const' reference to this object.
3954
3956 BloombergLP::bslmf::MovableRef<Optional_Base> rhs);
3957 // Assign to this object the value of the specified 'rhs' object, and
3958 // return a non-'const' reference to this object. The allocators of
3959 // this object and 'rhs' both remain unchanged. The contents of 'rhs'
3960 // are either move-constructed into or move-assigned to this object.
3961 // 'rhs' is left in a valid but unspecified state.
3962
3963 t_TYPE *operator->();
3964 // Return a pointer providing modifiable access to the underlying
3965 // 't_TYPE' object. The behavior is undefined if this object is
3966 // disengaged.
3967
3968# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
3969
3970 t_TYPE& operator*() &;
3971 t_TYPE&& operator*() &&;
3972 // Return a reference providing modifiable access to the underlying
3973 // 't_TYPE' object. The behavior is undefined if this object is
3974 // disengaged.
3975
3976# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
3977
3978 t_TYPE& operator*();
3979 // Return a reference providing modifiable access to the underlying
3980 // 't_TYPE' object. The behavior is undefined if this object is
3981 // disengaged.
3982
3983# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
3984
3985 // ACCESSORS
3986 bool has_value() const BSLS_KEYWORD_NOEXCEPT;
3987 // Return 'false' if this object is disengaged, and 'true' otherwise.
3988
3989# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
3990 const t_TYPE& value() const &;
3991 const t_TYPE&& value() const &&;
3992 // Return a reference providing non-modifiable access to the underlying
3993 // 't_TYPE' object if 'true == has_value()' and throw
3994 // 'bsl::bad_optional_access' otherwise.
3995# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
3996 const t_TYPE& value() const;
3997 // Return a reference providing non-modifiable access to the underlying
3998 // 't_TYPE' object. Throws a 'bsl::bad_optional_access' if the
3999 // 'Optional_Base' object is disengaged.
4000
4001# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
4002
4003# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4004 template <class t_ANY_TYPE>
4005 t_TYPE value_or(
4006 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&;
4007 // Return a copy of the underlying object of a (template parameter)
4008 // 't_TYPE' if this object is non-null, and the specified 'value'
4009 // converted to 't_TYPE' otherwise. Note that this method returns *by*
4010 // *value*, so may be inefficient in some contexts.
4011# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4012 template <class t_ANY_TYPE>
4013 t_TYPE value_or(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const;
4014 // Return a copy of the underlying object of a (template parameter)
4015 // 't_TYPE' if this object is non-null, and the specified 'value'
4016 // converted to 't_TYPE' otherwise. Note that this method returns *by*
4017 // *value*, so may be inefficient in some contexts.
4018# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
4019
4020 const t_TYPE *operator->() const;
4021 // Return a pointer providing non-modifiable access to the underlying
4022 // 't_TYPE' object. The behavior is undefined if this object is
4023 // disengaged.
4024
4025# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4026 const t_TYPE& operator*() const&;
4027 const t_TYPE&& operator*() const&&;
4028 // Return a reference providing non-modifiable access to the underlying
4029 // 't_TYPE' object. The behavior is undefined if this object is
4030 // disengaged.
4031# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
4032 const t_TYPE& operator*() const;
4033 // Return a reference providing non-modifiable access to the underlying
4034 // 't_TYPE' object. The behavior is undefined if this object is
4035 // disengaged.
4036# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
4037
4038#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
4039 explicit operator bool() const BSLS_KEYWORD_NOEXCEPT;
4040 // Return 'false' if this object is disengaged, and 'true' otherwise.
4041#else
4042 // Simulation of explicit conversion to bool. Inlined to work around xlC
4043 // bug when out-of-line.
4044 operator UnspecifiedBool() const BSLS_NOTHROW_SPEC
4045 {
4046 return UnspecifiedBoolUtil::makeValue(has_value());
4047 }
4048#endif // BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT else
4049};
4050# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY else
4051
4052} // close package namespace
4053
4054
4055namespace bsl {
4056
4057// ============================================================================
4058// Section: Definition of Class Template 'optional'
4059// ============================================================================
4060
4061 // ==============
4062 // class optional
4063 // ==============
4064
4065template <class t_TYPE>
4066class optional : public BloombergLP::bslstl::Optional_Base<t_TYPE> {
4067 private:
4068 // PRIVATE TYPES
4069 typedef BloombergLP::bslstl::Optional_Base<t_TYPE> BaseType;
4070
4071 typedef typename BaseType::AllocType AllocType;
4072
4073 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
4074
4075 public:
4076 // TRAITS
4078 optional,
4079 BloombergLP::bslma::UsesBslmaAllocator,
4080 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value);
4082 optional,
4083 BloombergLP::bslmf::UsesAllocatorArgT,
4084 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value);
4086 optional,
4087 BloombergLP::bslmf::IsBitwiseMoveable,
4088 BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
4090 optional,
4091 BloombergLP::bslmf::IsBitwiseCopyable,
4092 BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
4093
4094 // CREATORS
4095
4096 /// Create a disengaged `optional` object. Use the currently installed
4097 /// default allocator to supply memory.
4099
4100 /// Create a disengaged `optional` object. Use the currently installed
4101 /// default allocator to supply memory.
4102 optional(bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT; // IMPLICIT
4103
4104#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
4105 template <class t_DERIVED>
4106 optional(BloombergLP::bslmf::MovableRef<t_DERIVED> original,
4110 // If the 'optional' base class of the specified 'original' holds a
4111 // value, create an 'optional' object whose contained value is
4112 // initialized by moving from that value; otherwise, create a
4113 // disengaged 'optional' object. The allocator associated with the
4114 // 'optional' base class of 'original' is propagated for use in the
4115 // newly-created object. 'original' is left in a valid, but
4116 // unspecified state. Note that this constructor does not participate
4117 // in overload resolution unless 'optional' is an accessible base class
4118 // of 't_DERIVED' or 't_DERIVED' is 'optional' itself (in which case
4119 // the instantiation provides the move constructor in C++03; a move
4120 // constructor is implicitly declared in C++11).
4121#endif
4122
4123 template <class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
4127 t_ANY_TYPE));
4128 // IMPLICIT
4129
4130 /// Create an `optional` object whose contained value is initialized by
4131 /// forwarding from the specified `value`. Use the currently installed
4132 /// default allocator to supply memory. Note that this constructor
4133 /// participates in overload resolution only when `t_TYPE` is
4134 /// constructible from `t_ANY_TYPE` and is implicit only when
4135 /// `t_ANY_TYPE` is implicitly convertible to `t_TYPE`.
4136 template <class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
4137 explicit optional(
4138 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
4141
4142 template <class t_ANY_TYPE>
4143 optional(
4144 const optional<t_ANY_TYPE>& original,
4146 t_TYPE,
4147 const t_ANY_TYPE&),
4149 const t_ANY_TYPE&));
4150 // IMPLICIT
4151
4152 /// Create a disengaged `optional` object if the specified `original`
4153 /// object is disengaged, and an `optional` object with the value of
4154 /// `original.value()` converted to `t_TYPE` otherwise. Use the
4155 /// currently installed default allocator to supply memory. Note that
4156 /// this constructor participates in overload resolution only when
4157 /// `t_TYPE` is constructible from an lvalue of `const t_ANY_TYPE`, and
4158 /// is implicit only when an lvalue of `const t_ANY_TYPE` is implicitly
4159 /// convertible to `t_TYPE`.
4160 template <class t_ANY_TYPE>
4161 explicit optional(
4162 const optional<t_ANY_TYPE>& original,
4164 t_TYPE,
4165 const t_ANY_TYPE&),
4167 const t_ANY_TYPE&));
4168
4169 template <class t_ANY_TYPE>
4170 optional(
4171 BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
4173 t_ANY_TYPE),
4175 // IMPLICIT
4176
4177 /// Create a disengaged `optional` object if the specified `original`
4178 /// object is disengaged, and an `optional` object with the value of
4179 /// `original.value()` moved and converted to `t_TYPE` otherwise. Use
4180 /// the allocator from `original` to supply memory if `t_ANY_TYPE` is a
4181 /// non-const version of `t_TYPE`; otherwise, use the currently
4182 /// installed default allocator. `original` is left in a valid but
4183 /// unspecified state. Note that this constructor participates in
4184 /// overload resolution only when `t_TYPE` is constructible from an
4185 /// xvalue of `t_ANY_TYPE`, and is implicit only when an xvalue of
4186 /// `t_ANY_TYPE` is implicitly convertible to `t_TYPE`.
4187 template <class t_ANY_TYPE>
4188 explicit optional(
4189 BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
4191 t_ANY_TYPE),
4193
4194# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
4195 template <class t_ANY_TYPE>
4196 optional(
4197 const std::optional<t_ANY_TYPE>& original,
4199 t_TYPE,
4200 const t_ANY_TYPE&),
4202 t_ANY_TYPE));
4203 // IMPLICIT
4204
4205 /// Create a disengaged `optional` object if the specified `original`
4206 /// object is disengaged, and an `optional` object with the value of
4207 /// `original.value()` converted to `t_TYPE` otherwise. Use the
4208 /// currently installed default allocator to supply memory. Note that
4209 /// this constructor participates in overload resolution only when
4210 /// `t_TYPE` is constructible from an lvalue of `const t_ANY_TYPE`, and
4211 /// is implicit only when an lvalue of `const t_ANY_TYPE` is implicitly
4212 /// convertible to `t_TYPE`.
4213 template <class t_ANY_TYPE>
4214 explicit optional(
4215 const std::optional<t_ANY_TYPE>& original,
4217 t_TYPE,
4218 const t_ANY_TYPE&),
4220
4221 template <class t_ANY_TYPE>
4222 optional(
4223 std::optional<t_ANY_TYPE>&& original,
4225 t_ANY_TYPE),
4227 // IMPLICIT
4228
4229 /// Create a disengaged `optional` object if the specified `original`
4230 /// object is disengaged, and an `optional` object with the value of
4231 /// `original.value()` converted to `t_TYPE` otherwise. Use the
4232 /// currently installed default allocator to supply memory. Note that
4233 /// this constructor participates in overload resolution only when
4234 /// `t_TYPE` is constructible from an xvalue of `t_ANY_TYPE`, and is
4235 /// implicit only when an xvalue of `t_ANY_TYPE` is implicitly
4236 /// convertible to `t_TYPE`.
4237 template <class t_ANY_TYPE>
4238 explicit optional(
4239 std::optional<t_ANY_TYPE>&& original,
4241 t_ANY_TYPE),
4243# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
4244
4245#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
4246// {{{ BEGIN GENERATED CODE
4247// Command line: sim_cpp11_features.pl bslstl_optional.h
4248#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
4249#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
4250#endif
4251#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_H
4252#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_H BSLSTL_OPTIONAL_VARIADIC_LIMIT
4253#endif
4254#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0
4255 explicit optional(bsl::in_place_t);
4256#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0
4257
4258#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1
4259 template <class t_ARGS_01>
4260 explicit optional(bsl::in_place_t,
4261 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
4262#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1
4263
4264#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2
4265 template <class t_ARGS_01,
4266 class t_ARGS_02>
4267 explicit optional(bsl::in_place_t,
4268 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4269 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
4270#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2
4271
4272#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3
4273 template <class t_ARGS_01,
4274 class t_ARGS_02,
4275 class t_ARGS_03>
4276 explicit optional(bsl::in_place_t,
4277 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4278 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4279 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
4280#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3
4281
4282#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4
4283 template <class t_ARGS_01,
4284 class t_ARGS_02,
4285 class t_ARGS_03,
4286 class t_ARGS_04>
4287 explicit optional(bsl::in_place_t,
4288 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4289 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4290 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4291 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
4292#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4
4293
4294#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5
4295 template <class t_ARGS_01,
4296 class t_ARGS_02,
4297 class t_ARGS_03,
4298 class t_ARGS_04,
4299 class t_ARGS_05>
4300 explicit optional(bsl::in_place_t,
4301 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4302 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4303 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4304 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4305 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
4306#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5
4307
4308#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6
4309 template <class t_ARGS_01,
4310 class t_ARGS_02,
4311 class t_ARGS_03,
4312 class t_ARGS_04,
4313 class t_ARGS_05,
4314 class t_ARGS_06>
4315 explicit optional(bsl::in_place_t,
4316 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4317 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4318 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4319 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4320 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4321 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
4322#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6
4323
4324#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7
4325 template <class t_ARGS_01,
4326 class t_ARGS_02,
4327 class t_ARGS_03,
4328 class t_ARGS_04,
4329 class t_ARGS_05,
4330 class t_ARGS_06,
4331 class t_ARGS_07>
4332 explicit optional(bsl::in_place_t,
4333 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4334 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4335 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4336 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4337 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4338 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4339 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
4340#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7
4341
4342#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8
4343 template <class t_ARGS_01,
4344 class t_ARGS_02,
4345 class t_ARGS_03,
4346 class t_ARGS_04,
4347 class t_ARGS_05,
4348 class t_ARGS_06,
4349 class t_ARGS_07,
4350 class t_ARGS_08>
4351 explicit optional(bsl::in_place_t,
4352 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4353 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4354 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4355 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4356 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4357 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4358 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4359 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
4360#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8
4361
4362#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9
4363 template <class t_ARGS_01,
4364 class t_ARGS_02,
4365 class t_ARGS_03,
4366 class t_ARGS_04,
4367 class t_ARGS_05,
4368 class t_ARGS_06,
4369 class t_ARGS_07,
4370 class t_ARGS_08,
4371 class t_ARGS_09>
4372 explicit optional(bsl::in_place_t,
4373 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4374 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4375 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4376 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4377 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4378 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4379 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4380 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
4381 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
4382#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9
4383
4384#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10
4385 template <class t_ARGS_01,
4386 class t_ARGS_02,
4387 class t_ARGS_03,
4388 class t_ARGS_04,
4389 class t_ARGS_05,
4390 class t_ARGS_06,
4391 class t_ARGS_07,
4392 class t_ARGS_08,
4393 class t_ARGS_09,
4394 class t_ARGS_10>
4395 explicit optional(bsl::in_place_t,
4396 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4397 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4398 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4399 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4400 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4401 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4402 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4403 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
4404 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
4405 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
4406#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10
4407
4408
4409# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4410#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0
4411 template <class t_INIT_LIST_TYPE>
4412 explicit optional(bsl::in_place_t,
4413 std::initializer_list<t_INIT_LIST_TYPE> il);
4414#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0
4415
4416#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1
4417 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
4418 explicit optional(bsl::in_place_t,
4419 std::initializer_list<t_INIT_LIST_TYPE> il,
4420 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
4421#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1
4422
4423#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2
4424 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4425 class t_ARGS_02>
4426 explicit optional(bsl::in_place_t,
4427 std::initializer_list<t_INIT_LIST_TYPE> il,
4428 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4429 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
4430#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2
4431
4432#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3
4433 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4434 class t_ARGS_02,
4435 class t_ARGS_03>
4436 explicit optional(bsl::in_place_t,
4437 std::initializer_list<t_INIT_LIST_TYPE> il,
4438 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4439 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4440 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
4441#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3
4442
4443#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4
4444 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4445 class t_ARGS_02,
4446 class t_ARGS_03,
4447 class t_ARGS_04>
4448 explicit optional(bsl::in_place_t,
4449 std::initializer_list<t_INIT_LIST_TYPE> il,
4450 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4451 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4452 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4453 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
4454#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4
4455
4456#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5
4457 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4458 class t_ARGS_02,
4459 class t_ARGS_03,
4460 class t_ARGS_04,
4461 class t_ARGS_05>
4462 explicit optional(bsl::in_place_t,
4463 std::initializer_list<t_INIT_LIST_TYPE> il,
4464 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4465 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4466 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4467 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4468 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
4469#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5
4470
4471#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6
4472 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4473 class t_ARGS_02,
4474 class t_ARGS_03,
4475 class t_ARGS_04,
4476 class t_ARGS_05,
4477 class t_ARGS_06>
4478 explicit optional(bsl::in_place_t,
4479 std::initializer_list<t_INIT_LIST_TYPE> il,
4480 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4481 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4482 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4483 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4484 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4485 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
4486#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6
4487
4488#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7
4489 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4490 class t_ARGS_02,
4491 class t_ARGS_03,
4492 class t_ARGS_04,
4493 class t_ARGS_05,
4494 class t_ARGS_06,
4495 class t_ARGS_07>
4496 explicit optional(bsl::in_place_t,
4497 std::initializer_list<t_INIT_LIST_TYPE> il,
4498 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4499 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4500 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4501 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4502 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4503 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4504 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
4505#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7
4506
4507#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8
4508 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4509 class t_ARGS_02,
4510 class t_ARGS_03,
4511 class t_ARGS_04,
4512 class t_ARGS_05,
4513 class t_ARGS_06,
4514 class t_ARGS_07,
4515 class t_ARGS_08>
4516 explicit optional(bsl::in_place_t,
4517 std::initializer_list<t_INIT_LIST_TYPE> il,
4518 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4519 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4520 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4521 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4522 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4523 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4524 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4525 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
4526#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8
4527
4528#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9
4529 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4530 class t_ARGS_02,
4531 class t_ARGS_03,
4532 class t_ARGS_04,
4533 class t_ARGS_05,
4534 class t_ARGS_06,
4535 class t_ARGS_07,
4536 class t_ARGS_08,
4537 class t_ARGS_09>
4538 explicit optional(bsl::in_place_t,
4539 std::initializer_list<t_INIT_LIST_TYPE> il,
4540 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4541 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4542 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4543 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4544 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4545 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4546 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4547 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
4548 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
4549#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9
4550
4551#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10
4552 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4553 class t_ARGS_02,
4554 class t_ARGS_03,
4555 class t_ARGS_04,
4556 class t_ARGS_05,
4557 class t_ARGS_06,
4558 class t_ARGS_07,
4559 class t_ARGS_08,
4560 class t_ARGS_09,
4561 class t_ARGS_10>
4562 explicit optional(bsl::in_place_t,
4563 std::initializer_list<t_INIT_LIST_TYPE> il,
4564 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4565 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4566 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4567 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4568 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4569 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4570 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4571 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
4572 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
4573 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
4574#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10
4575
4576#endif
4577#else
4578// The generated code below is a workaround for the absence of perfect
4579// forwarding in some compilers.
4580 template <class... t_ARGS>
4581 explicit optional(bsl::in_place_t,
4582 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
4583
4584# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4585 template <class t_INIT_LIST_TYPE, class... t_ARGS>
4586 explicit optional(bsl::in_place_t,
4587 std::initializer_list<t_INIT_LIST_TYPE> il,
4588 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
4589#endif
4590// }}} END GENERATED CODE
4591#endif
4592
4593 // These allocator-extended constructors can be called only when 't_TYPE'
4594 // is allocator-aware.
4595
4596 /// Create a disengaged `optional` object. Use the specified
4597 /// `allocator` to supply memory.
4598 optional(bsl::allocator_arg_t, AllocType allocator);
4599
4600 /// Create a disengaged `optional` object. Use the specified
4601 /// `allocator` to supply memory.
4602 optional(bsl::allocator_arg_t, AllocType allocator, bsl::nullopt_t);
4603
4604 /// If the specified `original` contains a value, create an `optional`
4605 /// object whose contained value is initialized from `*original`;
4606 /// otherwise, create a disengaged `optional` object. Use the specified
4607 /// `allocator` to supply memory.
4608 optional(bsl::allocator_arg_t,
4609 AllocType allocator,
4610 const optional& original);
4611
4612 /// If the `optional` base class of the specified `original` holds a
4613 /// value, create an `optional` object whose contained value is
4614 /// initialized by moving from that value; otherwise, create a
4615 /// disengaged `optional` object. Use the specified `allocator` to
4616 /// supply memory. `original` is left in a valid, but unspecified
4617 /// state. Note that this constructor does not participate in overload
4618 /// resolution unless `optional` is an accessible base class of
4619 /// `t_DERIVED` or `t_DERIVED` is `optional` itself (in which case the
4620 /// instantiation provides the allocator-extended move constructor).
4621 template <class t_DERIVED>
4622 optional(bsl::allocator_arg_t,
4623 AllocType allocator,
4624 BSLMF_MOVABLEREF_DEDUCE(t_DERIVED) original,
4626 typename bsl::remove_reference<t_DERIVED>::type));
4627
4628 /// Create an `optional` object whose contained value is initialized by
4629 /// forwarding from the specified `value`. Use the specified
4630 /// `allocator` to supply memory. Note that this constructor
4631 /// participates in overload resolution only when `t_TYPE` is
4632 /// constructible from `t_ANY_TYPE`, and is implicit only when
4633 /// `t_ANY_TYPE` is implicitly convertible to `t_TYPE`.
4634 template <class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
4635 optional(bsl::allocator_arg_t,
4636 AllocType allocator,
4637 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
4640 t_ANY_TYPE));
4641 template <class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
4642 explicit optional(
4643 bsl::allocator_arg_t,
4644 AllocType allocator,
4645 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
4648
4649 /// Create a disengaged `optional` object if the specified `original`
4650 /// object is disengaged, and an `optional` object with the value of
4651 /// `original.value()` converted to `t_TYPE` otherwise. Use the
4652 /// specified `allocator` to supply memory. Note that this constructor
4653 /// participates in overload resolution only when `t_TYPE` is
4654 /// constructible from an lvalue of `const t_ANY_TYPE`, and is implicit
4655 /// only when an lvalue of `const t_ANY_TYPE` is implicitly convertible
4656 /// to `t_TYPE`.
4657 template <class t_ANY_TYPE>
4658 optional(
4659 bsl::allocator_arg_t,
4660 AllocType allocator,
4661 const optional<t_ANY_TYPE>& original,
4663 t_TYPE,
4664 const t_ANY_TYPE&),
4666 const t_ANY_TYPE&));
4667 template <class t_ANY_TYPE>
4668 explicit optional(
4669 bsl::allocator_arg_t,
4670 AllocType allocator,
4671 const optional<t_ANY_TYPE>& original,
4673 t_TYPE,
4674 const t_ANY_TYPE&),
4676 const t_ANY_TYPE&));
4677
4678 /// Create a disengaged `optional` object if the specified `original`
4679 /// object is disengaged, and an `optional` object with the value of
4680 /// `original.value()` moved and converted to `t_TYPE` otherwise. Use
4681 /// the specified `allocator` to supply memory. `original` is left in a
4682 /// valid but unspecified state. Note that this constructor
4683 /// participates in overload resolution only when `t_TYPE` is
4684 /// constructible from an xvalue of `t_ANY_TYPE`, and is implicit only
4685 /// when an xvalue of `t_ANY_TYPE` is implicitly convertible to
4686 /// `t_TYPE`.
4687 template <class t_ANY_TYPE>
4688 optional(
4689 bsl::allocator_arg_t,
4690 AllocType allocator,
4691 BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
4693 t_ANY_TYPE),
4695 template <class t_ANY_TYPE>
4696 explicit optional(
4697 bsl::allocator_arg_t,
4698 AllocType allocator,
4699 BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
4701 t_ANY_TYPE),
4703
4704# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
4705 /// Create a disengaged `optional` object if the specified `original`
4706 /// object is disengaged, and an `optional` object with the value of
4707 /// `original.value()` converted to `t_TYPE` otherwise. Use the
4708 /// specified `allocator` to supply memory. Note that this constructor
4709 /// participates in overload resolution only when `t_TYPE` is
4710 /// constructible from an lvalue of `const t_ANY_TYPE`, and is implicit
4711 /// only when an lvalue of `const t_ANY_TYPE` is implicitly convertible
4712 /// to `t_TYPE`.
4713 template <class t_ANY_TYPE>
4714 optional(
4715 bsl::allocator_arg_t,
4716 AllocType allocator,
4717 const std::optional<t_ANY_TYPE>& original,
4719 t_TYPE,
4720 const t_ANY_TYPE&),
4722 const t_ANY_TYPE&));
4723 template <class t_ANY_TYPE>
4724 explicit optional(
4725 bsl::allocator_arg_t,
4726 AllocType allocator,
4727 const std::optional<t_ANY_TYPE>& original,
4729 t_TYPE,
4730 const t_ANY_TYPE&),
4732 const t_ANY_TYPE));
4733
4734 /// Create a disengaged `optional` object if the specified `original`
4735 /// object is disengaged, and an `optional` object with the value of
4736 /// `original.value()` moved and converted to `t_TYPE` otherwise. Use
4737 /// the specified `allocator` to supply memory. `original` is left in a
4738 /// valid but unspecified state. Note that this constructor
4739 /// participates in overload resolution only when `t_TYPE` is
4740 /// constructible from an xvalue of `t_ANY_TYPE`, and is implicit only
4741 /// when an xvalue of `t_ANY_TYPE` is implicitly convertible to
4742 /// `t_TYPE`.
4743 template <class t_ANY_TYPE>
4744 optional(
4745 bsl::allocator_arg_t,
4746 AllocType allocator,
4747 std::optional<t_ANY_TYPE>&& original,
4749 t_ANY_TYPE),
4751 template <class t_ANY_TYPE>
4752 explicit optional(
4753 bsl::allocator_arg_t,
4754 AllocType allocator,
4755 std::optional<t_ANY_TYPE>&& original,
4757 t_ANY_TYPE),
4759# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
4760
4761#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
4762// {{{ BEGIN GENERATED CODE
4763// Command line: sim_cpp11_features.pl bslstl_optional.h
4764#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
4765#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
4766#endif
4767#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_I
4768#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_I BSLSTL_OPTIONAL_VARIADIC_LIMIT
4769#endif
4770#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0
4771 explicit optional(bsl::allocator_arg_t,
4772 AllocType allocator,
4774#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0
4775
4776#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1
4777 template <class t_ARGS_01>
4778 explicit optional(bsl::allocator_arg_t,
4779 AllocType allocator,
4781 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
4782#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1
4783
4784#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2
4785 template <class t_ARGS_01,
4786 class t_ARGS_02>
4787 explicit optional(bsl::allocator_arg_t,
4788 AllocType allocator,
4790 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4791 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
4792#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2
4793
4794#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3
4795 template <class t_ARGS_01,
4796 class t_ARGS_02,
4797 class t_ARGS_03>
4798 explicit optional(bsl::allocator_arg_t,
4799 AllocType allocator,
4801 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4802 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4803 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
4804#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3
4805
4806#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4
4807 template <class t_ARGS_01,
4808 class t_ARGS_02,
4809 class t_ARGS_03,
4810 class t_ARGS_04>
4811 explicit optional(bsl::allocator_arg_t,
4812 AllocType allocator,
4814 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4815 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4816 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4817 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
4818#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4
4819
4820#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5
4821 template <class t_ARGS_01,
4822 class t_ARGS_02,
4823 class t_ARGS_03,
4824 class t_ARGS_04,
4825 class t_ARGS_05>
4826 explicit optional(bsl::allocator_arg_t,
4827 AllocType allocator,
4829 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4830 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4831 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4832 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4833 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
4834#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5
4835
4836#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6
4837 template <class t_ARGS_01,
4838 class t_ARGS_02,
4839 class t_ARGS_03,
4840 class t_ARGS_04,
4841 class t_ARGS_05,
4842 class t_ARGS_06>
4843 explicit optional(bsl::allocator_arg_t,
4844 AllocType allocator,
4846 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4847 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4848 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4849 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4850 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4851 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
4852#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6
4853
4854#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7
4855 template <class t_ARGS_01,
4856 class t_ARGS_02,
4857 class t_ARGS_03,
4858 class t_ARGS_04,
4859 class t_ARGS_05,
4860 class t_ARGS_06,
4861 class t_ARGS_07>
4862 explicit optional(bsl::allocator_arg_t,
4863 AllocType allocator,
4865 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4866 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4867 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4868 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4869 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4870 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4871 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
4872#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7
4873
4874#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8
4875 template <class t_ARGS_01,
4876 class t_ARGS_02,
4877 class t_ARGS_03,
4878 class t_ARGS_04,
4879 class t_ARGS_05,
4880 class t_ARGS_06,
4881 class t_ARGS_07,
4882 class t_ARGS_08>
4883 explicit optional(bsl::allocator_arg_t,
4884 AllocType allocator,
4886 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4887 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4888 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4889 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4890 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4891 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4892 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4893 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
4894#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8
4895
4896#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9
4897 template <class t_ARGS_01,
4898 class t_ARGS_02,
4899 class t_ARGS_03,
4900 class t_ARGS_04,
4901 class t_ARGS_05,
4902 class t_ARGS_06,
4903 class t_ARGS_07,
4904 class t_ARGS_08,
4905 class t_ARGS_09>
4906 explicit optional(bsl::allocator_arg_t,
4907 AllocType allocator,
4909 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4910 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4911 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4912 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4913 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4914 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4915 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4916 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
4917 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
4918#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9
4919
4920#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10
4921 template <class t_ARGS_01,
4922 class t_ARGS_02,
4923 class t_ARGS_03,
4924 class t_ARGS_04,
4925 class t_ARGS_05,
4926 class t_ARGS_06,
4927 class t_ARGS_07,
4928 class t_ARGS_08,
4929 class t_ARGS_09,
4930 class t_ARGS_10>
4931 explicit optional(bsl::allocator_arg_t,
4932 AllocType allocator,
4934 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4935 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4936 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
4937 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
4938 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
4939 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
4940 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
4941 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
4942 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
4943 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
4944#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10
4945
4946
4947# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4948#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0
4949 template <class t_INIT_LIST_TYPE>
4950 explicit optional(bsl::allocator_arg_t,
4951 AllocType allocator,
4953 std::initializer_list<t_INIT_LIST_TYPE> il);
4954#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0
4955
4956#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1
4957 template <class t_INIT_LIST_TYPE, class t_ARGS_01>
4958 explicit optional(bsl::allocator_arg_t,
4959 AllocType allocator,
4961 std::initializer_list<t_INIT_LIST_TYPE> il,
4962 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
4963#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1
4964
4965#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2
4966 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4967 class t_ARGS_02>
4968 explicit optional(bsl::allocator_arg_t,
4969 AllocType allocator,
4971 std::initializer_list<t_INIT_LIST_TYPE> il,
4972 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4973 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
4974#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2
4975
4976#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3
4977 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4978 class t_ARGS_02,
4979 class t_ARGS_03>
4980 explicit optional(bsl::allocator_arg_t,
4981 AllocType allocator,
4983 std::initializer_list<t_INIT_LIST_TYPE> il,
4984 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4985 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
4986 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
4987#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3
4988
4989#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4
4990 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
4991 class t_ARGS_02,
4992 class t_ARGS_03,
4993 class t_ARGS_04>
4994 explicit optional(bsl::allocator_arg_t,
4995 AllocType allocator,
4997 std::initializer_list<t_INIT_LIST_TYPE> il,
4998 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
4999 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5000 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5001 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
5002#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4
5003
5004#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5
5005 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
5006 class t_ARGS_02,
5007 class t_ARGS_03,
5008 class t_ARGS_04,
5009 class t_ARGS_05>
5010 explicit optional(bsl::allocator_arg_t,
5011 AllocType allocator,
5013 std::initializer_list<t_INIT_LIST_TYPE> il,
5014 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5015 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5016 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5017 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5018 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
5019#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5
5020
5021#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6
5022 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
5023 class t_ARGS_02,
5024 class t_ARGS_03,
5025 class t_ARGS_04,
5026 class t_ARGS_05,
5027 class t_ARGS_06>
5028 explicit optional(bsl::allocator_arg_t,
5029 AllocType allocator,
5031 std::initializer_list<t_INIT_LIST_TYPE> il,
5032 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5033 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5034 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5035 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5036 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5037 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
5038#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6
5039
5040#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7
5041 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
5042 class t_ARGS_02,
5043 class t_ARGS_03,
5044 class t_ARGS_04,
5045 class t_ARGS_05,
5046 class t_ARGS_06,
5047 class t_ARGS_07>
5048 explicit optional(bsl::allocator_arg_t,
5049 AllocType allocator,
5051 std::initializer_list<t_INIT_LIST_TYPE> il,
5052 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5053 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5054 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5055 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5056 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5057 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
5058 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
5059#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7
5060
5061#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8
5062 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
5063 class t_ARGS_02,
5064 class t_ARGS_03,
5065 class t_ARGS_04,
5066 class t_ARGS_05,
5067 class t_ARGS_06,
5068 class t_ARGS_07,
5069 class t_ARGS_08>
5070 explicit optional(bsl::allocator_arg_t,
5071 AllocType allocator,
5073 std::initializer_list<t_INIT_LIST_TYPE> il,
5074 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5075 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5076 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5077 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5078 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5079 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
5080 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
5081 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
5082#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8
5083
5084#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9
5085 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
5086 class t_ARGS_02,
5087 class t_ARGS_03,
5088 class t_ARGS_04,
5089 class t_ARGS_05,
5090 class t_ARGS_06,
5091 class t_ARGS_07,
5092 class t_ARGS_08,
5093 class t_ARGS_09>
5094 explicit optional(bsl::allocator_arg_t,
5095 AllocType allocator,
5097 std::initializer_list<t_INIT_LIST_TYPE> il,
5098 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5099 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5100 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5101 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5102 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5103 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
5104 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
5105 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
5106 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
5107#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9
5108
5109#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10
5110 template <class t_INIT_LIST_TYPE, class t_ARGS_01,
5111 class t_ARGS_02,
5112 class t_ARGS_03,
5113 class t_ARGS_04,
5114 class t_ARGS_05,
5115 class t_ARGS_06,
5116 class t_ARGS_07,
5117 class t_ARGS_08,
5118 class t_ARGS_09,
5119 class t_ARGS_10>
5120 explicit optional(bsl::allocator_arg_t,
5121 AllocType allocator,
5123 std::initializer_list<t_INIT_LIST_TYPE> il,
5124 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5125 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5126 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5127 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5128 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5129 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
5130 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
5131 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
5132 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
5133 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
5134#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10
5135
5136# endif
5137#else
5138// The generated code below is a workaround for the absence of perfect
5139// forwarding in some compilers.
5140 template <class... t_ARGS>
5141 explicit optional(bsl::allocator_arg_t,
5142 AllocType allocator,
5144 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
5145
5146# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
5147 template <class t_INIT_LIST_TYPE, class... t_ARGS>
5148 explicit optional(bsl::allocator_arg_t,
5149 AllocType allocator,
5151 std::initializer_list<t_INIT_LIST_TYPE> il,
5152 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
5153# endif
5154// }}} END GENERATED CODE
5155#endif
5156
5157 // MANIPULATORS
5158
5159 // We implement 'operator=' in the most derived class to avoid having to
5160 // repeat constraints in each of the three implementations of
5161 // 'Optional_Base'.
5162
5163 /// Reset this object to be disengaged and return a reference providing
5164 /// modifiable access to this object.
5166
5167#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
5168 template <class t_DERIVED>
5170 operator=(BloombergLP::bslmf::MovableRef<t_DERIVED> rhs);
5171 // If the 'optional' base class of the specified 'rhs' holds a value,
5172 // move-construct or move-assign the contained value of '*this' from
5173 // that value. Otherwise, set '*this' to be disengaged. Return a
5174 // reference providing modifiable access to this object. 'rhs' is left
5175 // in a valid but unspecified state. This method does not participate
5176 // in overload resolution unless 'optional' is an accessible base class
5177 // of 't_DERIVED' or 't_DERIVED' is 'optional' itself (in which case
5178 // the instantiation provides the move assignment operator in C++03; a
5179 // move assignment operator is implicitly declared in C++11).
5180#endif
5181
5182 /// Disengage this object if the specified `rhs` object is disengaged,
5183 /// and assign to this object the value of `rhs.value()` (of
5184 /// `t_ANY_TYPE`) converted to `t_TYPE` otherwise. Return a reference
5185 /// providing modifiable access to this object. Note that this method
5186 /// does not participate in overload resolution unless `t_TYPE` and
5187 /// `t_ANY_TYPE` are compatible.
5188 template <class t_ANY_TYPE>
5189 BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE&)&
5190 operator=(const optional<t_ANY_TYPE>& rhs);
5191
5192 /// Disengage this object if the specified `rhs` object is disengaged,
5193 /// and move assign to this object the value of `rhs.value()` (of
5194 /// `t_ANY_TYPE`) converted to `t_TYPE` otherwise. Return a reference
5195 /// providing modifiable access to this object. Note that this method
5196 /// does not participate in overload resolution unless `t_TYPE` and
5197 /// `t_ANY_TYPE` are compatible.
5198 template <class t_ANY_TYPE>
5200 operator=(BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) rhs);
5201
5202#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
5203 /// Assign to this object the value of the specified `rhs` object
5204 /// converted to `t_TYPE`, and return a reference providing modifiable
5205 /// access to this object. Note that this method may invoke assignment
5206 /// from `rhs`, or construction from `rhs`, depending on whether this
5207 /// object is engaged. This assignment operator does not participate in
5208 /// overload resolution if `t_ANY_TYPE` is possibly cv-qualified
5209 /// `bsl::optional<t_TYPE>`. Also note that an assignment of the form
5210 /// `o = {};`, where `o` is of type `optional`, will always assign to
5211 /// `o` the empty state, and never call this overload (see
5212 /// implementation notes).
5213 template <class t_ANY_TYPE = t_TYPE>
5215 operator=(t_ANY_TYPE&& rhs);
5216#else
5217 // The existence of MovableRef in C++11 affects the above functions, and
5218 // they need to be defined in terms of rvalue references and perfect
5219 // forwarding. For C++03, the MovableRef overloads are provided below.
5220
5221 optional& operator=(const t_TYPE& rhs);
5222 // Assign to this object the value of the specified 'rhs', and return a
5223 // reference providing modifiable access to this object.
5224
5225 optional& operator=(BloombergLP::bslmf::MovableRef<t_TYPE> rhs);
5226 // Assign to this object the value of the specified 'rhs', and return a
5227 // reference providing modifiable access to this object. The contents
5228 // of 'rhs' are either move-constructed into or move-assigned to this
5229 // object. 'rhs' is left in a valid but unspecified state.
5230
5231 template <class t_ANY_TYPE>
5233 operator=(const t_ANY_TYPE& rhs);
5234 // Assign to this object the value of the specified 'rhs' object (of
5235 // 'ANY_TYPE') converted to 'TYPE', and return a reference providing
5236 // modifiable access to this object. Note that this method may invoke
5237 // assignment from 'rhs', or construction from 'rhs', depending on
5238 // whether this 'optional' object is engaged.
5239
5240 template <class t_ANY_TYPE>
5242 operator=(BloombergLP::bslmf::MovableRef<t_ANY_TYPE> rhs);
5243#endif // RVALUES else
5244
5245#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
5246 /// Disengage this object if the specified `rhs` object is disengaged,
5247 /// and assign to this object the value of `rhs.value()` (of
5248 /// `t_ANY_TYPE`) converted to `t_TYPE` otherwise. Return a reference
5249 /// providing modifiable access to this object. Note that this method
5250 /// does not participate in overload resolution unless `t_TYPE` and
5251 /// `t_ANY_TYPE` are compatible.
5252 template <class t_ANY_TYPE = t_TYPE>
5253 BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(t_TYPE, const t_ANY_TYPE&)&
5254 operator=(const std::optional<t_ANY_TYPE>& rhs);
5255
5256 /// Disengage this object if the specified `rhs` object is disengaged,
5257 /// and move assign to this object the value of `rhs.value()` (of
5258 /// `t_ANY_TYPE`) converted to `t_TYPE` otherwise. Return a reference
5259 /// providing modifiable access to this object. Note that this method
5260 /// does not participate in overload resolution unless `t_TYPE` and
5261 /// `t_ANY_TYPE` are compatible.
5262 template <class t_ANY_TYPE = t_TYPE>
5264 operator=(std::optional<t_ANY_TYPE>&& rhs);
5265# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
5266};
5267
5268} // close namespace bsl
5269
5270// ============================================================================
5271// Section: Type Traits on Allocator-Unaware 'Optional_Base'
5272// ============================================================================
5273
5274
5275namespace bslma {
5276
5277template <class t_TYPE>
5278struct UsesBslmaAllocator<bslstl::Optional_Base<t_TYPE, false> >
5280};
5281
5282template <class t_TYPE>
5283struct UsesBslmaAllocator<bsl::optional<t_TYPE> >
5284: UsesBslmaAllocator<t_TYPE> {
5285};
5286
5287} // close namespace bslma
5288
5289
5290namespace bsl {
5291
5292// ============================================================================
5293// Section: CTAD Constructors
5294// ============================================================================
5295
5296# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
5297// CLASS TEMPLATE DEDUCTION GUIDES
5298
5299/// Deduce the specified type `t_TYPE` from the corresponding type supplied
5300/// to the constructor of `optional`.
5301template <class t_TYPE>
5302optional(t_TYPE) -> optional<t_TYPE>;
5303
5304/// Deduce the specified type `t_TYPE` from the corresponding type supplied
5305/// to the constructor of `optional`. This guide does not participate in
5306/// deduction unless the deduced type `t_TYPE` supports the bslma allocator
5307/// model, and the specified `t_ALLOC` can be implicitly converted to
5308/// `bsl::allocator<char>`.
5309template <class t_TYPE,
5310 class t_ALLOC,
5311 class = typename bsl::enable_if_t<
5312 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>,
5313 class = typename bsl::enable_if_t<
5314 bsl::is_convertible_v<t_ALLOC, bsl::allocator<char>>>
5315 >
5316optional(bsl::allocator_arg_t, t_ALLOC, t_TYPE)
5317-> optional<t_TYPE>;
5318
5319/// Deduce the specified type `t_TYPE` from the corresponding template
5320/// parameter type supplied to the constructor of `optional`. This guide
5321/// does not participate in deduction unless the deduced type `t_TYPE`
5322/// supports the bslma allocator model, and the specified `t_ALLOC` can be
5323/// implicitly converted to `bsl::allocator<char>`.
5324template <class t_TYPE,
5325 class t_ALLOC,
5326 class = typename bsl::enable_if_t<
5327 BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>,
5328 class = typename bsl::enable_if_t<
5329 bsl::is_convertible_v<t_ALLOC, bsl::allocator<char>>>
5330 >
5331optional(bsl::allocator_arg_t, t_ALLOC, optional<t_TYPE>)
5332-> optional<t_TYPE>;
5333# endif // BSLS_COMPILERFEATURES_SUPPORT_CTAD
5334
5335// ============================================================================
5336// Section: Free Function Declarations
5337// ============================================================================
5338
5339// FREE FUNCTIONS
5340
5341/// Efficiently exchange the values of the specified `lhs` and `rhs`
5342/// objects. This method provides the no-throw exception-safety guarantee
5343/// if the template parameter `t_TYPE` provides that guarantee, `lhs` and
5344/// `rhs` have equal allocators, and `lhs.hasValue() == rhs.hasValue()`.
5345template <class t_TYPE>
5347 void>::type
5349
5350/// Efficiently exchange the values of the specified `lhs` and `rhs`
5351/// objects. This method provides the no-throw exception-safety guarantee
5352/// if the template parameter `t_TYPE` provides that guarantee and the
5353/// result of the `hasValue` method for `lhs` and `rhs` is the same.
5354template <class t_TYPE>
5356 void>::type
5358
5359// HASH SPECIALIZATIONS
5360
5361/// Pass the specified `input` to the specified `hashAlg`, where `hashAlg`
5362/// is a hashing algorithm.
5363template <class t_HASHALG, class t_TYPE>
5364void hashAppend(t_HASHALG& hashAlg, const optional<t_TYPE>& input);
5365
5366// FREE OPERATORS
5367template <class t_LHS_TYPE, class t_RHS_TYPE>
5369 const bsl::optional<t_RHS_TYPE>& rhs)
5370 BSLSTL_OPTIONAL_REQUIRES(requires {
5371 { *lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5372 });
5373 // Return 'true' if the specified 'lhs' and 'rhs' 'optional' objects have
5374 // the same value, and 'false' otherwise. Two 'optional' objects have the
5375 // same value if both are disengaged, or if both are engaged and the values
5376 // of their underlying objects compare equal.
5377
5378template <class t_LHS_TYPE, class t_RHS_TYPE>
5380 const bsl::optional<t_RHS_TYPE>& rhs)
5381 BSLSTL_OPTIONAL_REQUIRES(requires {
5382 { *lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5383 });
5384 // Return 'true' if the specified 'lhs' and 'rhs' 'optional' objects do not
5385 // have the same value, and 'false' otherwise. Two 'optional' objects do
5386 // not have the same value if one is disengaged and the other is engaged,
5387 // or if both are engaged and the values of their underlying objects do not
5388 // compare equal.
5389
5390template <class t_LHS_TYPE, class t_RHS_TYPE>
5391bool operator<(const bsl::optional<t_LHS_TYPE>& lhs,
5392 const bsl::optional<t_RHS_TYPE>& rhs)
5393 BSLSTL_OPTIONAL_REQUIRES(requires {
5394 { *lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5395 });
5396 // Return 'true' if the specified 'lhs' 'optional' object is ordered before
5397 // the specified 'rhs' 'optional' object, and 'false' otherwise. 'lhs' is
5398 // ordered before 'rhs' if 'lhs' is disengaged and 'rhs' is engaged or if
5399 // both are engaged and 'lhs.value()' is ordered before 'rhs.value()'.
5400
5401template <class t_LHS_TYPE, class t_RHS_TYPE>
5402bool operator>(const bsl::optional<t_LHS_TYPE>& lhs,
5403 const bsl::optional<t_RHS_TYPE>& rhs)
5404 BSLSTL_OPTIONAL_REQUIRES(requires {
5405 { *lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5406 });
5407 // Return 'true' if the specified 'lhs' 'optional' object is ordered after
5408 // the specified 'rhs' 'optional' object, and 'false' otherwise. 'lhs' is
5409 // ordered after 'rhs' if 'lhs' is engaged and 'rhs' is disengaged or if
5410 // both are engaged and 'lhs.value()' is ordered after 'rhs.value()'.
5411
5412template <class t_LHS_TYPE, class t_RHS_TYPE>
5414 const bsl::optional<t_RHS_TYPE>& rhs)
5415 BSLSTL_OPTIONAL_REQUIRES(requires {
5416 { *lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5417 });
5418 // Return 'true' if the specified 'lhs' 'optional' object is ordered before
5419 // the specified 'rhs' 'optional' object or if 'lhs' and 'rhs' have the
5420 // same value, and 'false' otherwise. (See 'operator<' and 'operator=='.)
5421
5422template <class t_LHS_TYPE, class t_RHS_TYPE>
5424 const bsl::optional<t_RHS_TYPE>& rhs)
5425 BSLSTL_OPTIONAL_REQUIRES(requires {
5426 { *lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5427 });
5428 // Return 'true' if the specified 'lhs' 'optional' object is ordered after
5429 // the specified 'rhs' 'optional' object or if 'lhs' and 'rhs' have the
5430 // same value, and 'false' otherwise. (See 'operator>' and 'operator=='.)
5431
5432// comparison with 'nullopt_t'
5433
5434template <class t_TYPE>
5436 const bsl::optional<t_TYPE>& value,
5438#if !(defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) && \
5439 defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS))
5440template <class t_TYPE>
5442 const bsl::nullopt_t&,
5443 const bsl::optional<t_TYPE>& value)
5445 // Return 'true' if the specified 'value' is disengaged, and 'false'
5446 // otherwise.
5447
5448template <class t_TYPE>
5450 const bsl::optional<t_TYPE>& value,
5452template <class t_TYPE>
5454 const bsl::nullopt_t&,
5455 const bsl::optional<t_TYPE>& value)
5457 // Return 'true' if the specified 'value' is engaged, and 'false'
5458 // otherwise.
5459
5460template <class t_TYPE>
5462 const bsl::optional<t_TYPE>&,
5464 // Return 'false'. Note that 'bsl::nullopt_t' never orders after a
5465 // 'bsl::optional'.
5466
5467template <class t_TYPE>
5469 const bsl::nullopt_t&,
5471 // Return 'true' if the specified 'value' is engaged, and 'false'
5472 // otherwise. Note that 'bsl::nullopt_t' is ordered before any
5473 // 'bsl::optional' that is engaged.
5474
5475template <class t_TYPE>
5477 const bsl::optional<t_TYPE>& value,
5479 // Return 'true' if the specified 'value' is engaged, and 'false'
5480 // otherwise.
5481
5482template <class t_TYPE>
5484 const bsl::nullopt_t&,
5486 // Return 'false'. Note that 'bsl::nullopt_t' never orders after a
5487 // 'bsl::optional'.
5488
5489template <class t_TYPE>
5491 const bsl::optional<t_TYPE>& value,
5493 // Return 'true' if the specified 'value' is disengaged, and 'false'
5494 // otherwise.
5495
5496template <class t_TYPE>
5498 const bsl::nullopt_t&,
5500 // Return 'true'. Note that 'bsl::nullopt_t' is ordered before any
5501 // 'bsl::optional' that is engaged.
5502
5503template <class t_TYPE>
5505 const bsl::optional<t_TYPE>&,
5507 // Return 'true'. Note that 'bsl::nullopt_t' is ordered before any
5508 // 'bsl::optional' that is engaged.
5509
5510template <class t_TYPE>
5512 const bsl::nullopt_t&,
5514 // Return 'true' if the specified 'value' is disengaged, and 'false'
5515 // otherwise.
5516#endif // !(defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) &&
5517 // defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS))
5518
5519// comparison with 'value_type'
5520
5521template <class t_LHS_TYPE, class t_RHS_TYPE>
5523 const t_RHS_TYPE& rhs)
5525 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5526 && requires {
5527 { *lhs == rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5528 });
5529template <class t_LHS_TYPE, class t_RHS_TYPE>
5530bool operator==(const t_LHS_TYPE& lhs,
5531 const bsl::optional<t_RHS_TYPE>& rhs)
5533 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5534 && requires {
5535 { lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5536 });
5537 // Return 'true' if the specified 'lhs' and 'rhs' objects have the same
5538 // value, and 'false' otherwise. An 'optional' object and a value of some
5539 // type have the same value if the optional object is engaged and its
5540 // underlying value compares equal to the other value.
5541
5542template <class t_LHS_TYPE, class t_RHS_TYPE>
5544 const t_RHS_TYPE& rhs)
5546 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5547 && requires {
5548 { *lhs != rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5549 });
5550template <class t_LHS_TYPE, class t_RHS_TYPE>
5551bool operator!=(const t_LHS_TYPE& lhs,
5552 const bsl::optional<t_RHS_TYPE>& rhs)
5554 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5555 && requires {
5556 { lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5557 });
5558 // Return 'true' if the specified 'lhs' and 'rhs' objects do not have the
5559 // same value, and 'false' otherwise. An 'optional' object and a value of
5560 // some type do not have the same value if either the optional object is
5561 // disengaged, or its underlying value does not compare equal to the other
5562 // value.
5563
5564template <class t_LHS_TYPE, class t_RHS_TYPE>
5565bool operator<(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
5567 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5568 && requires {
5569 { *lhs < rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5570 });
5571 // Return 'true' if the specified 'lhs' 'optional' object is ordered before
5572 // the specified 'rhs', and 'false' otherwise. 'lhs' is ordered before
5573 // 'rhs' if 'lhs' is disengaged or 'lhs.value()' is ordered before 'rhs'.
5574
5575template <class t_LHS_TYPE, class t_RHS_TYPE>
5576bool operator<(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
5578 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5579 && requires {
5580 { lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5581 });
5582 // Return 'true' if the specified 'lhs' is ordered before the specified
5583 // 'rhs' 'optional' object, and 'false' otherwise. 'lhs' is ordered before
5584 // 'rhs' if 'rhs' is engaged and 'lhs' is ordered before 'rhs.value()'.
5585
5586template <class t_LHS_TYPE, class t_RHS_TYPE>
5587bool operator>(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
5589 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5590 && requires {
5591 { *lhs > rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5592 });
5593 // Return 'true' if the specified 'lhs' 'optional' object is ordered after
5594 // the specified 'rhs', and 'false' otherwise. 'lhs' is ordered after
5595 // 'rhs' if 'lhs' is engaged and 'lhs.value()' is ordered after 'rhs'.
5596
5597template <class t_LHS_TYPE, class t_RHS_TYPE>
5598bool operator>(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
5600 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5601 && requires {
5602 { lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5603 });
5604 // Return 'true' if the specified 'lhs' is ordered after the specified
5605 // 'rhs' 'optional' object, and 'false' otherwise. 'lhs' is ordered after
5606 // 'rhs' if 'rhs' is disengaged or 'lhs' is ordered after 'rhs.value()'.
5607
5608template <class t_LHS_TYPE, class t_RHS_TYPE>
5609bool operator<=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
5611 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5612 && requires {
5613 { *lhs <= rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5614 });
5615 // Return 'true' if the specified 'lhs' 'optional' object is ordered before
5616 // the specified 'rhs' or 'lhs' and 'rhs' have the same value, and 'false'
5617 // otherwise. (See 'operator<' and 'operator=='.)
5618
5619template <class t_LHS_TYPE, class t_RHS_TYPE>
5620bool operator<=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
5622 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5623 && requires {
5624 { lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5625 });
5626 // Return 'true' if the specified 'lhs' is ordered before the specified
5627 // 'rhs' 'optional' object or 'lhs' and 'rhs' have the same value, and
5628 // 'false' otherwise. (See 'operator<' and 'operator=='.)
5629
5630template <class t_LHS_TYPE, class t_RHS_TYPE>
5631bool operator>=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
5633 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
5634 && requires {
5635 { *lhs >= rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5636 });
5637 // Return 'true' if the specified 'lhs' 'optional' object is ordered after
5638 // the specified 'rhs' or if 'lhs' and 'rhs' have the same value, and
5639 // 'false' otherwise. (See 'operator>' and 'operator=='.)
5640
5641template <class t_LHS_TYPE, class t_RHS_TYPE>
5642bool operator>=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
5644 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
5645 && requires {
5646 { lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
5647 });
5648 // Return 'true' if the specified 'lhs' is ordered after the specified
5649 // 'rhs' 'optional' object or if 'lhs' and 'rhs' have the same value, or
5650 // 'false' otherwise. (See 'operator>' and 'operator=='.)
5651
5652#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
5653 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
5654/// Perform a three-way comparison of the specified `lhs` and the specified
5655/// `rhs` objects by using the comparison operators of `t_LHS` and `t_RHS`;
5656/// return the result of that comparison.
5657template <class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
5658constexpr compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
5659 const bsl::optional<t_LHS>& lhs,
5660 const bsl::optional<t_RHS>& rhs);
5661
5662/// Perform a three-way comparison of the specified `lhs` and the specified
5663/// `rhs` objects by using the comparison operators of `t_LHS` and `t_RHS`;
5664/// return the result of that comparison.
5665template <class t_LHS, class t_RHS>
5666requires (!BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS>) &&
5667 three_way_comparable_with<t_LHS, t_RHS>
5668constexpr compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
5669 const bsl::optional<t_LHS>& lhs,
5670 const t_RHS& rhs);
5671
5672/// Perform a three-way comparison of the specified `value` and `nullopt`;
5673/// return the result of that comparison.
5674template <class t_TYPE>
5675constexpr strong_ordering operator<=>(
5676 const bsl::optional<t_TYPE>& value,
5678
5679/// Perform a three-way comparison of the specified `lhs` and the specified
5680/// `rhs` objects by using the comparison operators of `t_LHS` and `t_RHS`;
5681/// return the result of that comparison.
5682template <class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
5683constexpr compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
5684 const bsl::optional<t_LHS>& lhs,
5685 const std::optional<t_RHS>& rhs);
5686#endif
5687
5688# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
5689/// Efficiently exchange the values of the specified `lhs` and `rhs`
5690/// objects. This method provides the no-throw exception-safety guarantee
5691/// if the template parameter `t_TYPE` provides that guarantee and the
5692/// result of the `hasValue` method for `lhs` and `rhs` is the same.
5693template <class t_TYPE>
5695 void>::type
5696swap(bsl::optional<t_TYPE>& lhs, std::optional<t_TYPE>& rhs);
5697template <class t_TYPE>
5699 void>::type
5700swap(std::optional<t_TYPE>& lhs, bsl::optional<t_TYPE>& rhs);
5701
5702// comparison with 'std::optional'
5703
5704/// Return `true` if the specified `lhs` and `rhs` optional objects have the
5705/// same value, and `false` otherwise. Two optional objects have the same
5706/// value if both are disengaged, or if both are engaged and the values of
5707/// their underlying objects compare equal. Note that this function will
5708/// fail to compile if `t_LHS_TYPE` and `t_RHS_TYPE` are not compatible.
5709template <class t_LHS_TYPE, class t_RHS_TYPE>
5710bool operator==(const std::optional<t_LHS_TYPE>& lhs,
5711 const bsl::optional<t_RHS_TYPE>& rhs);
5712template <class t_LHS_TYPE, class t_RHS_TYPE>
5714 const std::optional<t_RHS_TYPE>& rhs);
5715
5716/// Return `true` if the specified `lhs` and `rhs` optional objects do not
5717/// have the same value, and `false` otherwise. Two optional objects do not
5718/// have the same value if one is disengaged and the other is engaged, or if
5719/// both are engaged and the values of their underlying objects do not
5720/// compare equal. Note that this function will fail to compile if
5721/// `t_LHS_TYPE` and `t_RHS_TYPE` are not compatible.
5722template <class t_LHS_TYPE, class t_RHS_TYPE>
5724 const std::optional<t_RHS_TYPE>& rhs);
5725template <class t_LHS_TYPE, class t_RHS_TYPE>
5726bool operator!=(const std::optional<t_LHS_TYPE>& lhs,
5727 const bsl::optional<t_RHS_TYPE>& rhs);
5728
5729/// Return `true` if the specified `lhs` optional object is ordered before
5730/// the specified `rhs` optional object, and `false` otherwise. `lhs` is
5731/// ordered before `rhs` if `lhs` is disengaged and `rhs` is engaged or if
5732/// both are engaged and `lhs.value()` is ordered before `rhs.value()`.
5733/// Note that this function will fail to compile if `t_LHS_TYPE` and
5734/// `t_RHS_TYPE` are not compatible.
5735template <class t_LHS_TYPE, class t_RHS_TYPE>
5736bool operator<(const bsl::optional<t_LHS_TYPE>& lhs,
5737 const std::optional<t_RHS_TYPE>& rhs);
5738template <class t_LHS_TYPE, class t_RHS_TYPE>
5739bool operator<(const std::optional<t_LHS_TYPE>& lhs,
5740 const bsl::optional<t_RHS_TYPE>& rhs);
5741
5742/// Return `true` if the specified `lhs` optional object is ordered after
5743/// the specified `rhs` optional object, and `false` otherwise. `lhs` is
5744/// ordered after `rhs` if `lhs` is engaged and `rhs` is disengaged or if
5745/// both are engaged and `lhs.value()` is ordered after `rhs.value()`. Note
5746/// that this function will fail to compile if `t_LHS_TYPE` and `t_RHS_TYPE`
5747/// are not compatible.
5748template <class t_LHS_TYPE, class t_RHS_TYPE>
5749bool operator>(const bsl::optional<t_LHS_TYPE>& lhs,
5750 const std::optional<t_RHS_TYPE>& rhs);
5751template <class t_LHS_TYPE, class t_RHS_TYPE>
5752bool operator>(const std::optional<t_LHS_TYPE>& lhs,
5753 const bsl::optional<t_RHS_TYPE>& rhs);
5754
5755/// Return `true` if the specified `lhs` is ordered before the specified
5756/// `rhs` optional object or `lhs` and `rhs` have the same value, and
5757/// `false` otherwise. (See `operator<` and `operator==`.) Note that this
5758/// function will fail to compile if `t_LHS_TYPE` and `t_RHS_TYPE` are not
5759/// compatible.
5760template <class t_LHS_TYPE, class t_RHS_TYPE>
5762 const std::optional<t_RHS_TYPE>& rhs);
5763template <class t_LHS_TYPE, class t_RHS_TYPE>
5764bool operator<=(const std::optional<t_LHS_TYPE>& lhs,
5765 const bsl::optional<t_RHS_TYPE>& rhs);
5766
5767/// Return `true` if the specified `lhs` optional object is ordered after
5768/// the specified `rhs` optional object or `lhs` and `rhs` have the same
5769/// value, and `false` otherwise. (See `operator>` and `operator==`.) Note
5770/// that this function will fail to compile if `t_LHS_TYPE` and `t_RHS_TYPE`
5771/// are not compatible.
5772template <class t_LHS_TYPE, class t_RHS_TYPE>
5774 const std::optional<t_RHS_TYPE>& rhs);
5775template <class t_LHS_TYPE, class t_RHS_TYPE>
5776bool operator>=(const std::optional<t_LHS_TYPE>& lhs,
5777 const bsl::optional<t_RHS_TYPE>& rhs);
5778#endif
5779
5780/// Return an `optional` object containing a `t_TYPE` object created by
5781/// invoking a `bsl::optional` allocator-extended `in_place_t` constructor
5782/// with the specified `alloc` as the allocator argument, and specified
5783/// `rhs` as the constructor argument. Note that this function will fail to
5784/// compile if `t_TYPE` doesn't use allocators.
5785template <class t_TYPE>
5787make_optional(bsl::allocator_arg_t,
5788 const typename bsl::optional<
5789 typename bsl::decay<t_TYPE>::type>::allocator_type& alloc,
5791
5792#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
5793// {{{ BEGIN GENERATED CODE
5794// Command line: sim_cpp11_features.pl bslstl_optional.h
5795#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
5796#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
5797#endif
5798#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_J
5799#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_J BSLSTL_OPTIONAL_VARIADIC_LIMIT
5800#endif
5801#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0
5802template <class t_TYPE>
5804 bsl::allocator_arg_t,
5805 typename bsl::optional<t_TYPE>::allocator_type const& alloc);
5806#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0
5807
5808#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1
5809template <class t_TYPE, class t_ARGS_01>
5811 bsl::allocator_arg_t,
5812 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5813 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
5814#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1
5815
5816#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2
5817template <class t_TYPE, class t_ARGS_01,
5818 class t_ARGS_02>
5820 bsl::allocator_arg_t,
5821 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5822 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5823 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
5824#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2
5825
5826#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3
5827template <class t_TYPE, class t_ARGS_01,
5828 class t_ARGS_02,
5829 class t_ARGS_03>
5831 bsl::allocator_arg_t,
5832 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5833 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5834 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5835 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
5836#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3
5837
5838#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4
5839template <class t_TYPE, class t_ARGS_01,
5840 class t_ARGS_02,
5841 class t_ARGS_03,
5842 class t_ARGS_04>
5844 bsl::allocator_arg_t,
5845 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5846 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5847 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5848 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5849 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
5850#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4
5851
5852#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5
5853template <class t_TYPE, class t_ARGS_01,
5854 class t_ARGS_02,
5855 class t_ARGS_03,
5856 class t_ARGS_04,
5857 class t_ARGS_05>
5859 bsl::allocator_arg_t,
5860 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5861 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5862 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5863 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5864 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5865 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
5866#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5
5867
5868#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6
5869template <class t_TYPE, class t_ARGS_01,
5870 class t_ARGS_02,
5871 class t_ARGS_03,
5872 class t_ARGS_04,
5873 class t_ARGS_05,
5874 class t_ARGS_06>
5876 bsl::allocator_arg_t,
5877 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5878 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5879 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5880 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5881 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5882 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5883 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
5884#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6
5885
5886#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7
5887template <class t_TYPE, class t_ARGS_01,
5888 class t_ARGS_02,
5889 class t_ARGS_03,
5890 class t_ARGS_04,
5891 class t_ARGS_05,
5892 class t_ARGS_06,
5893 class t_ARGS_07>
5895 bsl::allocator_arg_t,
5896 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5897 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5898 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5899 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5900 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5901 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5902 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
5903 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
5904#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7
5905
5906#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8
5907template <class t_TYPE, class t_ARGS_01,
5908 class t_ARGS_02,
5909 class t_ARGS_03,
5910 class t_ARGS_04,
5911 class t_ARGS_05,
5912 class t_ARGS_06,
5913 class t_ARGS_07,
5914 class t_ARGS_08>
5916 bsl::allocator_arg_t,
5917 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5918 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5919 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5920 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5921 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5922 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5923 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
5924 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
5925 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
5926#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8
5927
5928#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9
5929template <class t_TYPE, class t_ARGS_01,
5930 class t_ARGS_02,
5931 class t_ARGS_03,
5932 class t_ARGS_04,
5933 class t_ARGS_05,
5934 class t_ARGS_06,
5935 class t_ARGS_07,
5936 class t_ARGS_08,
5937 class t_ARGS_09>
5939 bsl::allocator_arg_t,
5940 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5941 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5942 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5943 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5944 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5945 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5946 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
5947 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
5948 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
5949 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
5950#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9
5951
5952#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10
5953template <class t_TYPE, class t_ARGS_01,
5954 class t_ARGS_02,
5955 class t_ARGS_03,
5956 class t_ARGS_04,
5957 class t_ARGS_05,
5958 class t_ARGS_06,
5959 class t_ARGS_07,
5960 class t_ARGS_08,
5961 class t_ARGS_09,
5962 class t_ARGS_10>
5964 bsl::allocator_arg_t,
5965 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5966 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
5967 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
5968 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
5969 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
5970 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
5971 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
5972 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
5973 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
5974 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
5975 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
5976#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10
5977
5978
5979# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS) && \
5980 !(defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900)
5981
5982#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0
5983template <class t_TYPE, class t_INIT_LIST_TYPE>
5985 bsl::allocator_arg_t,
5986 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5987 std::initializer_list<t_INIT_LIST_TYPE> il);
5988#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0
5989
5990#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1
5991template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01>
5993 bsl::allocator_arg_t,
5994 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
5995 std::initializer_list<t_INIT_LIST_TYPE> il,
5996 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
5997#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1
5998
5999#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2
6000template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6001 class t_ARGS_02>
6003 bsl::allocator_arg_t,
6004 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6005 std::initializer_list<t_INIT_LIST_TYPE> il,
6006 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6007 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
6008#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2
6009
6010#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3
6011template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6012 class t_ARGS_02,
6013 class t_ARGS_03>
6015 bsl::allocator_arg_t,
6016 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6017 std::initializer_list<t_INIT_LIST_TYPE> il,
6018 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6019 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6020 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
6021#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3
6022
6023#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4
6024template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6025 class t_ARGS_02,
6026 class t_ARGS_03,
6027 class t_ARGS_04>
6029 bsl::allocator_arg_t,
6030 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6031 std::initializer_list<t_INIT_LIST_TYPE> il,
6032 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6033 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6034 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6035 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
6036#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4
6037
6038#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5
6039template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6040 class t_ARGS_02,
6041 class t_ARGS_03,
6042 class t_ARGS_04,
6043 class t_ARGS_05>
6045 bsl::allocator_arg_t,
6046 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6047 std::initializer_list<t_INIT_LIST_TYPE> il,
6048 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6049 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6050 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6051 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6052 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
6053#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5
6054
6055#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6
6056template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6057 class t_ARGS_02,
6058 class t_ARGS_03,
6059 class t_ARGS_04,
6060 class t_ARGS_05,
6061 class t_ARGS_06>
6063 bsl::allocator_arg_t,
6064 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6065 std::initializer_list<t_INIT_LIST_TYPE> il,
6066 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6067 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6068 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6069 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6070 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6071 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
6072#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6
6073
6074#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7
6075template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6076 class t_ARGS_02,
6077 class t_ARGS_03,
6078 class t_ARGS_04,
6079 class t_ARGS_05,
6080 class t_ARGS_06,
6081 class t_ARGS_07>
6083 bsl::allocator_arg_t,
6084 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6085 std::initializer_list<t_INIT_LIST_TYPE> il,
6086 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6087 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6088 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6089 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6090 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6091 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6092 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
6093#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7
6094
6095#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8
6096template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6097 class t_ARGS_02,
6098 class t_ARGS_03,
6099 class t_ARGS_04,
6100 class t_ARGS_05,
6101 class t_ARGS_06,
6102 class t_ARGS_07,
6103 class t_ARGS_08>
6105 bsl::allocator_arg_t,
6106 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6107 std::initializer_list<t_INIT_LIST_TYPE> il,
6108 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6109 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6110 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6111 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6112 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6113 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6114 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6115 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
6116#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8
6117
6118#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9
6119template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6120 class t_ARGS_02,
6121 class t_ARGS_03,
6122 class t_ARGS_04,
6123 class t_ARGS_05,
6124 class t_ARGS_06,
6125 class t_ARGS_07,
6126 class t_ARGS_08,
6127 class t_ARGS_09>
6129 bsl::allocator_arg_t,
6130 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6131 std::initializer_list<t_INIT_LIST_TYPE> il,
6132 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6133 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6134 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6135 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6136 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6137 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6138 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6139 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
6140 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
6141#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9
6142
6143#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10
6144template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6145 class t_ARGS_02,
6146 class t_ARGS_03,
6147 class t_ARGS_04,
6148 class t_ARGS_05,
6149 class t_ARGS_06,
6150 class t_ARGS_07,
6151 class t_ARGS_08,
6152 class t_ARGS_09,
6153 class t_ARGS_10>
6155 bsl::allocator_arg_t,
6156 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6157 std::initializer_list<t_INIT_LIST_TYPE> il,
6158 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6159 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6160 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6161 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6162 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6163 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6164 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6165 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
6166 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
6167 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
6168#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10
6169
6170# endif
6171#else
6172// The generated code below is a workaround for the absence of perfect
6173// forwarding in some compilers.
6174template <class t_TYPE, class... t_ARGS>
6176 bsl::allocator_arg_t,
6177 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6178 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
6179
6180# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS) && \
6181 !(defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900)
6182
6183template <class t_TYPE, class t_INIT_LIST_TYPE, class... t_ARGS>
6185 bsl::allocator_arg_t,
6186 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
6187 std::initializer_list<t_INIT_LIST_TYPE> il,
6188 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
6189# endif
6190// }}} END GENERATED CODE
6191#endif
6192
6193/// Return an `optional` object containing a `t_TYPE` object created by
6194/// invoking a `bsl::optional` constructor with the specified `rhs` as the
6195/// constructor argument. If `t_TYPE` uses an allocator, the default
6196/// allocator will be used for the `optional` object.
6197template <class t_TYPE>
6200
6201/// Return an `optional` object containing a value-initialized `t_TYPE`
6202/// object. If `t_TYPE` uses an allocator, the default allocator will be
6203/// used for the `optional` object.
6204template <class t_TYPE>
6206
6207#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
6208// {{{ BEGIN GENERATED CODE
6209// Command line: sim_cpp11_features.pl bslstl_optional.h
6210#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
6211#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
6212#endif
6213#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_K
6214#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_K BSLSTL_OPTIONAL_VARIADIC_LIMIT
6215#endif
6216#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0
6217template <class t_TYPE, class t_ARG>
6220#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0
6221
6222#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1
6223template <class t_TYPE, class t_ARG, class t_ARGS_01>
6226 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
6227#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1
6228
6229#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2
6230template <class t_TYPE, class t_ARG, class t_ARGS_01,
6231 class t_ARGS_02>
6234 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6235 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
6236#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2
6237
6238#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3
6239template <class t_TYPE, class t_ARG, class t_ARGS_01,
6240 class t_ARGS_02,
6241 class t_ARGS_03>
6244 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6245 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6246 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
6247#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3
6248
6249#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4
6250template <class t_TYPE, class t_ARG, class t_ARGS_01,
6251 class t_ARGS_02,
6252 class t_ARGS_03,
6253 class t_ARGS_04>
6256 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6257 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6258 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6259 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
6260#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4
6261
6262#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5
6263template <class t_TYPE, class t_ARG, class t_ARGS_01,
6264 class t_ARGS_02,
6265 class t_ARGS_03,
6266 class t_ARGS_04,
6267 class t_ARGS_05>
6270 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6271 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6272 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6273 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6274 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
6275#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5
6276
6277#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6
6278template <class t_TYPE, class t_ARG, class t_ARGS_01,
6279 class t_ARGS_02,
6280 class t_ARGS_03,
6281 class t_ARGS_04,
6282 class t_ARGS_05,
6283 class t_ARGS_06>
6286 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6287 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6288 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6289 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6290 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6291 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
6292#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6
6293
6294#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7
6295template <class t_TYPE, class t_ARG, class t_ARGS_01,
6296 class t_ARGS_02,
6297 class t_ARGS_03,
6298 class t_ARGS_04,
6299 class t_ARGS_05,
6300 class t_ARGS_06,
6301 class t_ARGS_07>
6304 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6305 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6306 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6307 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6308 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6309 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6310 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
6311#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7
6312
6313#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8
6314template <class t_TYPE, class t_ARG, class t_ARGS_01,
6315 class t_ARGS_02,
6316 class t_ARGS_03,
6317 class t_ARGS_04,
6318 class t_ARGS_05,
6319 class t_ARGS_06,
6320 class t_ARGS_07,
6321 class t_ARGS_08>
6324 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6325 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6326 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6327 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6328 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6329 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6330 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6331 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
6332#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8
6333
6334#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9
6335template <class t_TYPE, class t_ARG, class t_ARGS_01,
6336 class t_ARGS_02,
6337 class t_ARGS_03,
6338 class t_ARGS_04,
6339 class t_ARGS_05,
6340 class t_ARGS_06,
6341 class t_ARGS_07,
6342 class t_ARGS_08,
6343 class t_ARGS_09>
6346 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6347 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6348 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6349 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6350 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6351 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6352 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6353 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
6354 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
6355#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9
6356
6357#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10
6358template <class t_TYPE, class t_ARG, class t_ARGS_01,
6359 class t_ARGS_02,
6360 class t_ARGS_03,
6361 class t_ARGS_04,
6362 class t_ARGS_05,
6363 class t_ARGS_06,
6364 class t_ARGS_07,
6365 class t_ARGS_08,
6366 class t_ARGS_09,
6367 class t_ARGS_10>
6370 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6371 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6372 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6373 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6374 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6375 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6376 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6377 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
6378 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
6379 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
6380#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10
6381
6382
6383# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS) && \
6384 !(defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900)
6385
6386#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0
6387template <class t_TYPE, class t_INIT_LIST_TYPE>
6389 std::initializer_list<t_INIT_LIST_TYPE> il);
6390#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0
6391
6392#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1
6393template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01>
6395 std::initializer_list<t_INIT_LIST_TYPE> il,
6396 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
6397#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1
6398
6399#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2
6400template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6401 class t_ARGS_02>
6403 std::initializer_list<t_INIT_LIST_TYPE> il,
6404 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6405 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
6406#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2
6407
6408#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3
6409template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6410 class t_ARGS_02,
6411 class t_ARGS_03>
6413 std::initializer_list<t_INIT_LIST_TYPE> il,
6414 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6415 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6416 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
6417#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3
6418
6419#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4
6420template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6421 class t_ARGS_02,
6422 class t_ARGS_03,
6423 class t_ARGS_04>
6425 std::initializer_list<t_INIT_LIST_TYPE> il,
6426 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6427 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6428 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6429 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
6430#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4
6431
6432#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5
6433template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6434 class t_ARGS_02,
6435 class t_ARGS_03,
6436 class t_ARGS_04,
6437 class t_ARGS_05>
6439 std::initializer_list<t_INIT_LIST_TYPE> il,
6440 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6441 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6442 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6443 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6444 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
6445#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5
6446
6447#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6
6448template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6449 class t_ARGS_02,
6450 class t_ARGS_03,
6451 class t_ARGS_04,
6452 class t_ARGS_05,
6453 class t_ARGS_06>
6455 std::initializer_list<t_INIT_LIST_TYPE> il,
6456 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6457 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6458 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6459 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6460 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6461 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
6462#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6
6463
6464#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7
6465template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6466 class t_ARGS_02,
6467 class t_ARGS_03,
6468 class t_ARGS_04,
6469 class t_ARGS_05,
6470 class t_ARGS_06,
6471 class t_ARGS_07>
6473 std::initializer_list<t_INIT_LIST_TYPE> il,
6474 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6475 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6476 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6477 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6478 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6479 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6480 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
6481#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7
6482
6483#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8
6484template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6485 class t_ARGS_02,
6486 class t_ARGS_03,
6487 class t_ARGS_04,
6488 class t_ARGS_05,
6489 class t_ARGS_06,
6490 class t_ARGS_07,
6491 class t_ARGS_08>
6493 std::initializer_list<t_INIT_LIST_TYPE> il,
6494 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6495 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6496 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6497 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6498 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6499 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6500 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6501 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
6502#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8
6503
6504#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9
6505template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6506 class t_ARGS_02,
6507 class t_ARGS_03,
6508 class t_ARGS_04,
6509 class t_ARGS_05,
6510 class t_ARGS_06,
6511 class t_ARGS_07,
6512 class t_ARGS_08,
6513 class t_ARGS_09>
6515 std::initializer_list<t_INIT_LIST_TYPE> il,
6516 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6517 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6518 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6519 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6520 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6521 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6522 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6523 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
6524 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
6525#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9
6526
6527#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10
6528template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
6529 class t_ARGS_02,
6530 class t_ARGS_03,
6531 class t_ARGS_04,
6532 class t_ARGS_05,
6533 class t_ARGS_06,
6534 class t_ARGS_07,
6535 class t_ARGS_08,
6536 class t_ARGS_09,
6537 class t_ARGS_10>
6539 std::initializer_list<t_INIT_LIST_TYPE> il,
6540 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6541 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6542 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6543 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6544 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6545 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6546 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6547 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
6548 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
6549 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
6550#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10
6551
6552
6553# endif
6554#else
6555// The generated code below is a workaround for the absence of perfect
6556// forwarding in some compilers.
6557template <class t_TYPE, class t_ARG, class... t_ARGS>
6560 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
6561
6562# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS) && \
6563 !(defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900)
6564
6565template <class t_TYPE, class t_INIT_LIST_TYPE, class... t_ARGS>
6567 std::initializer_list<t_INIT_LIST_TYPE> il,
6568 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
6569
6570# endif
6571// }}} END GENERATED CODE
6572#endif
6573
6574} // close namespace bsl
6575
6576// ============================================================================
6577// INLINE DEFINITIONS
6578// ============================================================================
6579
6580
6581namespace bslstl {
6582
6583// ============================================================================
6584// Section: bslstl::Optional_* Definitions
6585// ============================================================================
6586
6587 // ======================
6588 // class Optional_DataImp
6589 // ======================
6590
6591// CREATORS
6592template <class t_TYPE>
6594: d_hasValue(false)
6595{
6596}
6597
6598// MANIPULATORS
6599#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
6600// {{{ BEGIN GENERATED CODE
6601// Command line: sim_cpp11_features.pl bslstl_optional.h
6602#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
6603#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
6604#endif
6605#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_L
6606#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_L BSLSTL_OPTIONAL_VARIADIC_LIMIT
6607#endif
6608#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0
6609template <class t_TYPE>
6610inline
6612 bslma::Allocator *allocator)
6613{
6614 reset();
6615 BloombergLP::bslma::ConstructionUtil::construct(
6616 d_buffer.address(),
6617 allocator);
6618 d_hasValue = true;
6619 return d_buffer.object();
6620}
6621#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0
6622
6623#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1
6624template <class t_TYPE>
6625template <class t_ARGS_01>
6626inline
6628 bslma::Allocator *allocator,
6629 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
6630{
6631 reset();
6632 BloombergLP::bslma::ConstructionUtil::construct(
6633 d_buffer.address(),
6634 allocator,
6635 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
6636 d_hasValue = true;
6637 return d_buffer.object();
6638}
6639#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1
6640
6641#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2
6642template <class t_TYPE>
6643template <class t_ARGS_01,
6644 class t_ARGS_02>
6645inline
6647 bslma::Allocator *allocator,
6648 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6649 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
6650{
6651 reset();
6652 BloombergLP::bslma::ConstructionUtil::construct(
6653 d_buffer.address(),
6654 allocator,
6655 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6656 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
6657 d_hasValue = true;
6658 return d_buffer.object();
6659}
6660#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2
6661
6662#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3
6663template <class t_TYPE>
6664template <class t_ARGS_01,
6665 class t_ARGS_02,
6666 class t_ARGS_03>
6667inline
6669 bslma::Allocator *allocator,
6670 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6671 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6672 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
6673{
6674 reset();
6675 BloombergLP::bslma::ConstructionUtil::construct(
6676 d_buffer.address(),
6677 allocator,
6678 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6679 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
6680 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
6681 d_hasValue = true;
6682 return d_buffer.object();
6683}
6684#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3
6685
6686#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4
6687template <class t_TYPE>
6688template <class t_ARGS_01,
6689 class t_ARGS_02,
6690 class t_ARGS_03,
6691 class t_ARGS_04>
6692inline
6694 bslma::Allocator *allocator,
6695 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6696 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6697 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6698 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
6699{
6700 reset();
6701 BloombergLP::bslma::ConstructionUtil::construct(
6702 d_buffer.address(),
6703 allocator,
6704 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6705 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
6706 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
6707 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
6708 d_hasValue = true;
6709 return d_buffer.object();
6710}
6711#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4
6712
6713#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5
6714template <class t_TYPE>
6715template <class t_ARGS_01,
6716 class t_ARGS_02,
6717 class t_ARGS_03,
6718 class t_ARGS_04,
6719 class t_ARGS_05>
6720inline
6722 bslma::Allocator *allocator,
6723 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6724 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6725 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6726 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6727 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
6728{
6729 reset();
6730 BloombergLP::bslma::ConstructionUtil::construct(
6731 d_buffer.address(),
6732 allocator,
6733 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6734 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
6735 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
6736 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
6737 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
6738 d_hasValue = true;
6739 return d_buffer.object();
6740}
6741#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5
6742
6743#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6
6744template <class t_TYPE>
6745template <class t_ARGS_01,
6746 class t_ARGS_02,
6747 class t_ARGS_03,
6748 class t_ARGS_04,
6749 class t_ARGS_05,
6750 class t_ARGS_06>
6751inline
6753 bslma::Allocator *allocator,
6754 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6755 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6756 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6757 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6758 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6759 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
6760{
6761 reset();
6762 BloombergLP::bslma::ConstructionUtil::construct(
6763 d_buffer.address(),
6764 allocator,
6765 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6766 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
6767 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
6768 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
6769 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
6770 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
6771 d_hasValue = true;
6772 return d_buffer.object();
6773}
6774#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6
6775
6776#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7
6777template <class t_TYPE>
6778template <class t_ARGS_01,
6779 class t_ARGS_02,
6780 class t_ARGS_03,
6781 class t_ARGS_04,
6782 class t_ARGS_05,
6783 class t_ARGS_06,
6784 class t_ARGS_07>
6785inline
6787 bslma::Allocator *allocator,
6788 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6789 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6790 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6791 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6792 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6793 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6794 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
6795{
6796 reset();
6797 BloombergLP::bslma::ConstructionUtil::construct(
6798 d_buffer.address(),
6799 allocator,
6800 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6801 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
6802 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
6803 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
6804 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
6805 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
6806 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
6807 d_hasValue = true;
6808 return d_buffer.object();
6809}
6810#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7
6811
6812#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8
6813template <class t_TYPE>
6814template <class t_ARGS_01,
6815 class t_ARGS_02,
6816 class t_ARGS_03,
6817 class t_ARGS_04,
6818 class t_ARGS_05,
6819 class t_ARGS_06,
6820 class t_ARGS_07,
6821 class t_ARGS_08>
6822inline
6824 bslma::Allocator *allocator,
6825 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6826 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6827 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6828 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6829 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6830 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6831 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6832 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
6833{
6834 reset();
6835 BloombergLP::bslma::ConstructionUtil::construct(
6836 d_buffer.address(),
6837 allocator,
6838 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6839 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
6840 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
6841 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
6842 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
6843 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
6844 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
6845 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
6846 d_hasValue = true;
6847 return d_buffer.object();
6848}
6849#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8
6850
6851#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9
6852template <class t_TYPE>
6853template <class t_ARGS_01,
6854 class t_ARGS_02,
6855 class t_ARGS_03,
6856 class t_ARGS_04,
6857 class t_ARGS_05,
6858 class t_ARGS_06,
6859 class t_ARGS_07,
6860 class t_ARGS_08,
6861 class t_ARGS_09>
6862inline
6864 bslma::Allocator *allocator,
6865 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6866 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6867 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6868 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6869 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6870 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6871 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6872 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
6873 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
6874{
6875 reset();
6876 BloombergLP::bslma::ConstructionUtil::construct(
6877 d_buffer.address(),
6878 allocator,
6879 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6880 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
6881 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
6882 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
6883 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
6884 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
6885 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
6886 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
6887 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
6888 d_hasValue = true;
6889 return d_buffer.object();
6890}
6891#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9
6892
6893#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10
6894template <class t_TYPE>
6895template <class t_ARGS_01,
6896 class t_ARGS_02,
6897 class t_ARGS_03,
6898 class t_ARGS_04,
6899 class t_ARGS_05,
6900 class t_ARGS_06,
6901 class t_ARGS_07,
6902 class t_ARGS_08,
6903 class t_ARGS_09,
6904 class t_ARGS_10>
6905inline
6907 bslma::Allocator *allocator,
6908 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6909 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
6910 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
6911 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
6912 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
6913 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
6914 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
6915 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
6916 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
6917 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
6918{
6919 reset();
6920 BloombergLP::bslma::ConstructionUtil::construct(
6921 d_buffer.address(),
6922 allocator,
6923 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6924 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
6925 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
6926 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
6927 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
6928 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
6929 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
6930 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
6931 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
6932 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
6933 d_hasValue = true;
6934 return d_buffer.object();
6935}
6936#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10
6937
6938
6939# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
6940#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0
6941template <class t_TYPE>
6942template <class t_INIT_LIST_TYPE>
6944 bslma::Allocator *allocator,
6945 std::initializer_list<t_INIT_LIST_TYPE> il)
6946{
6947 reset();
6948 BloombergLP::bslma::ConstructionUtil::construct(
6949 d_buffer.address(),
6950 allocator,
6951 il);
6952 d_hasValue = true;
6953 return d_buffer.object();
6954}
6955#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0
6956
6957#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1
6958template <class t_TYPE>
6959template <class t_INIT_LIST_TYPE, class t_ARGS_01>
6961 bslma::Allocator *allocator,
6962 std::initializer_list<t_INIT_LIST_TYPE> il,
6963 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
6964{
6965 reset();
6966 BloombergLP::bslma::ConstructionUtil::construct(
6967 d_buffer.address(),
6968 allocator,
6969 il,
6970 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
6971 d_hasValue = true;
6972 return d_buffer.object();
6973}
6974#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1
6975
6976#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2
6977template <class t_TYPE>
6978template <class t_INIT_LIST_TYPE, class t_ARGS_01,
6979 class t_ARGS_02>
6981 bslma::Allocator *allocator,
6982 std::initializer_list<t_INIT_LIST_TYPE> il,
6983 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
6984 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
6985{
6986 reset();
6987 BloombergLP::bslma::ConstructionUtil::construct(
6988 d_buffer.address(),
6989 allocator,
6990 il,
6991 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
6992 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
6993 d_hasValue = true;
6994 return d_buffer.object();
6995}
6996#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2
6997
6998#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3
6999template <class t_TYPE>
7000template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7001 class t_ARGS_02,
7002 class t_ARGS_03>
7004 bslma::Allocator *allocator,
7005 std::initializer_list<t_INIT_LIST_TYPE> il,
7006 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7007 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7008 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
7009{
7010 reset();
7011 BloombergLP::bslma::ConstructionUtil::construct(
7012 d_buffer.address(),
7013 allocator,
7014 il,
7015 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7016 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7017 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
7018 d_hasValue = true;
7019 return d_buffer.object();
7020}
7021#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3
7022
7023#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4
7024template <class t_TYPE>
7025template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7026 class t_ARGS_02,
7027 class t_ARGS_03,
7028 class t_ARGS_04>
7030 bslma::Allocator *allocator,
7031 std::initializer_list<t_INIT_LIST_TYPE> il,
7032 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7033 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7034 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7035 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
7036{
7037 reset();
7038 BloombergLP::bslma::ConstructionUtil::construct(
7039 d_buffer.address(),
7040 allocator,
7041 il,
7042 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7043 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7044 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7045 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
7046 d_hasValue = true;
7047 return d_buffer.object();
7048}
7049#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4
7050
7051#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5
7052template <class t_TYPE>
7053template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7054 class t_ARGS_02,
7055 class t_ARGS_03,
7056 class t_ARGS_04,
7057 class t_ARGS_05>
7059 bslma::Allocator *allocator,
7060 std::initializer_list<t_INIT_LIST_TYPE> il,
7061 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7062 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7063 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7064 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7065 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
7066{
7067 reset();
7068 BloombergLP::bslma::ConstructionUtil::construct(
7069 d_buffer.address(),
7070 allocator,
7071 il,
7072 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7073 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7074 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7075 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7076 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
7077 d_hasValue = true;
7078 return d_buffer.object();
7079}
7080#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5
7081
7082#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6
7083template <class t_TYPE>
7084template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7085 class t_ARGS_02,
7086 class t_ARGS_03,
7087 class t_ARGS_04,
7088 class t_ARGS_05,
7089 class t_ARGS_06>
7091 bslma::Allocator *allocator,
7092 std::initializer_list<t_INIT_LIST_TYPE> il,
7093 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7094 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7095 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7096 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7097 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7098 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
7099{
7100 reset();
7101 BloombergLP::bslma::ConstructionUtil::construct(
7102 d_buffer.address(),
7103 allocator,
7104 il,
7105 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7106 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7107 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7108 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7109 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7110 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
7111 d_hasValue = true;
7112 return d_buffer.object();
7113}
7114#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6
7115
7116#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7
7117template <class t_TYPE>
7118template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7119 class t_ARGS_02,
7120 class t_ARGS_03,
7121 class t_ARGS_04,
7122 class t_ARGS_05,
7123 class t_ARGS_06,
7124 class t_ARGS_07>
7126 bslma::Allocator *allocator,
7127 std::initializer_list<t_INIT_LIST_TYPE> il,
7128 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7129 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7130 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7131 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7132 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7133 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7134 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
7135{
7136 reset();
7137 BloombergLP::bslma::ConstructionUtil::construct(
7138 d_buffer.address(),
7139 allocator,
7140 il,
7141 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7142 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7143 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7144 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7145 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7146 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7147 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
7148 d_hasValue = true;
7149 return d_buffer.object();
7150}
7151#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7
7152
7153#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8
7154template <class t_TYPE>
7155template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7156 class t_ARGS_02,
7157 class t_ARGS_03,
7158 class t_ARGS_04,
7159 class t_ARGS_05,
7160 class t_ARGS_06,
7161 class t_ARGS_07,
7162 class t_ARGS_08>
7164 bslma::Allocator *allocator,
7165 std::initializer_list<t_INIT_LIST_TYPE> il,
7166 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7167 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7168 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7169 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7170 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7171 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7172 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
7173 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
7174{
7175 reset();
7176 BloombergLP::bslma::ConstructionUtil::construct(
7177 d_buffer.address(),
7178 allocator,
7179 il,
7180 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7181 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7182 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7183 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7184 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7185 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7186 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
7187 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
7188 d_hasValue = true;
7189 return d_buffer.object();
7190}
7191#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8
7192
7193#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9
7194template <class t_TYPE>
7195template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7196 class t_ARGS_02,
7197 class t_ARGS_03,
7198 class t_ARGS_04,
7199 class t_ARGS_05,
7200 class t_ARGS_06,
7201 class t_ARGS_07,
7202 class t_ARGS_08,
7203 class t_ARGS_09>
7205 bslma::Allocator *allocator,
7206 std::initializer_list<t_INIT_LIST_TYPE> il,
7207 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7208 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7209 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7210 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7211 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7212 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7213 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
7214 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
7215 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
7216{
7217 reset();
7218 BloombergLP::bslma::ConstructionUtil::construct(
7219 d_buffer.address(),
7220 allocator,
7221 il,
7222 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7223 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7224 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7225 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7226 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7227 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7228 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
7229 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
7230 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
7231 d_hasValue = true;
7232 return d_buffer.object();
7233}
7234#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9
7235
7236#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10
7237template <class t_TYPE>
7238template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7239 class t_ARGS_02,
7240 class t_ARGS_03,
7241 class t_ARGS_04,
7242 class t_ARGS_05,
7243 class t_ARGS_06,
7244 class t_ARGS_07,
7245 class t_ARGS_08,
7246 class t_ARGS_09,
7247 class t_ARGS_10>
7249 bslma::Allocator *allocator,
7250 std::initializer_list<t_INIT_LIST_TYPE> il,
7251 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7252 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7253 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7254 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7255 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7256 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7257 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
7258 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
7259 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
7260 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
7261{
7262 reset();
7263 BloombergLP::bslma::ConstructionUtil::construct(
7264 d_buffer.address(),
7265 allocator,
7266 il,
7267 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7268 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7269 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7270 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7271 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7272 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7273 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
7274 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
7275 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
7276 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
7277 d_hasValue = true;
7278 return d_buffer.object();
7279}
7280#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10
7281
7282# endif
7283#else
7284// The generated code below is a workaround for the absence of perfect
7285// forwarding in some compilers.
7286template <class t_TYPE>
7287template <class... t_ARGS>
7288inline
7290 bslma::Allocator *allocator,
7291 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
7292{
7293 reset();
7294 BloombergLP::bslma::ConstructionUtil::construct(
7295 d_buffer.address(),
7296 allocator,
7297 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
7298 d_hasValue = true;
7299 return d_buffer.object();
7300}
7301
7302# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
7303template <class t_TYPE>
7304template <class t_INIT_LIST_TYPE, class... t_ARGS>
7306 bslma::Allocator *allocator,
7307 std::initializer_list<t_INIT_LIST_TYPE> il,
7308 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
7309{
7310 reset();
7311 BloombergLP::bslma::ConstructionUtil::construct(
7312 d_buffer.address(),
7313 allocator,
7314 il,
7315 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
7316 d_hasValue = true;
7317 return d_buffer.object();
7318}
7319# endif
7320// }}} END GENERATED CODE
7321#endif
7322
7323template <class t_TYPE>
7325{
7326 if (d_hasValue) {
7327 d_hasValue = false;
7328 bslma::DestructionUtil::destroy(d_buffer.address());
7329 }
7330}
7331
7332# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
7333template <class t_TYPE>
7334inline
7336{
7337 // We do not assert on an empty object in this function as the assert level
7338 // is determined by the 'Optional_Base' method invoking 'value()'
7339
7340 return d_buffer.object();
7341}
7342
7343template <class t_TYPE>
7344inline
7346{
7347 // We do not assert on an empty object in this function as the assert level
7348 // is determined by the 'Optional_Base' method invoking 'value()'
7349
7350 return std::move(d_buffer.object());
7351}
7352# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
7353template <class t_TYPE>
7354inline
7356{
7357 // We do not assert on an empty object in this function as the assert level
7358 // is determined by the 'Optional_Base' method invoking 'value()'
7359
7360 return d_buffer.object();
7361}
7362# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
7363
7364// ACCESSORS
7365template <class t_TYPE>
7366inline
7368{
7369 return d_hasValue;
7370}
7371
7372# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
7373template <class t_TYPE>
7374inline
7375const t_TYPE& Optional_DataImp<t_TYPE>::value() const&
7376{
7377 // We do not assert on an empty object in this function as the assert level
7378 // is determined by the 'Optional_Base' method invoking 'value()'
7379
7380 return d_buffer.object();
7381}
7382
7383template <class t_TYPE>
7384inline
7385const t_TYPE&& Optional_DataImp<t_TYPE>::value() const&&
7386{
7387 // We do not assert on an empty object in this function as the assert level
7388 // is determined by the 'Optional_Base' method invoking 'value()'
7389
7390 return std::move(d_buffer.object());
7391}
7392# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
7393template <class t_TYPE>
7394inline
7395const t_TYPE& Optional_DataImp<t_TYPE>::value() const
7396{
7397 // We do not assert on an empty object in this function as the assert level
7398 // is determined by the 'Optional_Base' method invoking 'value()'
7399
7400 return d_buffer.object();
7401}
7402# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
7403
7404 // ===================
7405 // class Optional_Data
7406 // ===================
7407
7408// CREATORS
7409template <class t_TYPE, bool t_IS_TRIVIALLY_DESTRUCTIBLE>
7411{
7412 this->reset();
7413}
7414
7415// ============================================================================
7416// Section: Allocator-Aware 'Optional_Base' Method Definitions
7417// ============================================================================
7418
7419 // ===================
7420 // class Optional_Base
7421 // ===================
7422
7423// PROTECTED CREATORS
7424template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7425inline
7427{
7428}
7429
7430template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7431inline
7433{
7434}
7435
7436template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7437inline
7439 const Optional_Base& original)
7440{
7441 if (original.has_value()) {
7442 emplace(*original);
7443 }
7444}
7445
7446template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7447inline
7449 BloombergLP::bslmf::MovableRef<Optional_Base> original)
7452: d_allocator(MoveUtil::access(original).get_allocator())
7453{
7454 Optional_Base& lvalue = original;
7455
7456 if (lvalue.has_value()) {
7457 emplace(MoveUtil::move(*lvalue));
7458 }
7459}
7460
7461template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7462template <class t_ANY_TYPE>
7463inline
7465 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
7466 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
7467{
7468 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value));
7469}
7470
7471template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7472template <class t_ANY_TYPE>
7473inline
7475 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
7476 const Optional_Base<t_ANY_TYPE>& original)
7477{
7478 if (original.has_value()) {
7479 emplace(original.value());
7480 }
7481}
7482
7483template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7484template <class t_ANY_TYPE>
7485inline
7487 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
7488 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original,
7490 t_ANY_TYPE))
7491{
7492 Optional_Base<t_ANY_TYPE>& lvalue = original;
7493 if (lvalue.has_value()) {
7494 emplace(MoveUtil::move(*lvalue));
7495 }
7496}
7497
7498template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7499template <class t_ANY_TYPE>
7500inline
7502 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
7503 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original,
7505 t_ANY_TYPE))
7506: d_allocator(MoveUtil::access(original).get_allocator())
7507{
7508 Optional_Base<t_ANY_TYPE>& lvalue = original;
7509 if (lvalue.has_value()) {
7510 emplace(MoveUtil::move(*lvalue));
7511 }
7512}
7513
7514# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
7515template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7516template <class t_ANY_TYPE>
7517inline
7518Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7519 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
7520 const std::optional<t_ANY_TYPE>& original)
7521{
7522 if (original.has_value()) {
7523 emplace(original.value());
7524 }
7525}
7526
7527template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7528template <class t_ANY_TYPE>
7529inline
7530Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7531 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
7532 std::optional<t_ANY_TYPE>&& original)
7533{
7534 if (original.has_value()) {
7535 emplace(std::move(original.value()));
7536 }
7537}
7538# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
7539
7540#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
7541// {{{ BEGIN GENERATED CODE
7542// Command line: sim_cpp11_features.pl bslstl_optional.h
7543#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
7544#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
7545#endif
7546#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_M
7547#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_M BSLSTL_OPTIONAL_VARIADIC_LIMIT
7548#endif
7549#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0
7550template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7551inline
7552Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7554{
7555 emplace();
7556}
7557#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0
7558
7559#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1
7560template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7561template <class t_ARGS_01>
7562inline
7563Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7565 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
7566{
7567 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
7568}
7569#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1
7570
7571#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2
7572template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7573template <class t_ARGS_01,
7574 class t_ARGS_02>
7575inline
7576Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7578 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7579 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
7580{
7581 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7582 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
7583}
7584#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2
7585
7586#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3
7587template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7588template <class t_ARGS_01,
7589 class t_ARGS_02,
7590 class t_ARGS_03>
7591inline
7592Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7594 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7595 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7596 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
7597{
7598 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7599 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7600 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
7601}
7602#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3
7603
7604#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4
7605template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7606template <class t_ARGS_01,
7607 class t_ARGS_02,
7608 class t_ARGS_03,
7609 class t_ARGS_04>
7610inline
7611Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7613 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7614 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7615 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7616 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
7617{
7618 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7619 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7620 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7621 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
7622}
7623#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4
7624
7625#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5
7626template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7627template <class t_ARGS_01,
7628 class t_ARGS_02,
7629 class t_ARGS_03,
7630 class t_ARGS_04,
7631 class t_ARGS_05>
7632inline
7633Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7635 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7636 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7637 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7638 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7639 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
7640{
7641 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7642 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7643 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7644 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7645 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
7646}
7647#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5
7648
7649#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6
7650template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7651template <class t_ARGS_01,
7652 class t_ARGS_02,
7653 class t_ARGS_03,
7654 class t_ARGS_04,
7655 class t_ARGS_05,
7656 class t_ARGS_06>
7657inline
7658Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7660 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7661 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7662 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7663 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7664 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7665 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
7666{
7667 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7668 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7669 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7670 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7671 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7672 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
7673}
7674#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6
7675
7676#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7
7677template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7678template <class t_ARGS_01,
7679 class t_ARGS_02,
7680 class t_ARGS_03,
7681 class t_ARGS_04,
7682 class t_ARGS_05,
7683 class t_ARGS_06,
7684 class t_ARGS_07>
7685inline
7686Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7688 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7689 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7690 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7691 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7692 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7693 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7694 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
7695{
7696 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7697 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7698 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7699 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7700 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7701 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7702 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
7703}
7704#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7
7705
7706#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8
7707template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7708template <class t_ARGS_01,
7709 class t_ARGS_02,
7710 class t_ARGS_03,
7711 class t_ARGS_04,
7712 class t_ARGS_05,
7713 class t_ARGS_06,
7714 class t_ARGS_07,
7715 class t_ARGS_08>
7716inline
7717Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7719 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7720 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7721 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7722 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7723 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7724 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7725 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
7726 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
7727{
7728 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7729 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7730 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7731 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7732 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7733 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7734 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
7735 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
7736}
7737#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8
7738
7739#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9
7740template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7741template <class t_ARGS_01,
7742 class t_ARGS_02,
7743 class t_ARGS_03,
7744 class t_ARGS_04,
7745 class t_ARGS_05,
7746 class t_ARGS_06,
7747 class t_ARGS_07,
7748 class t_ARGS_08,
7749 class t_ARGS_09>
7750inline
7751Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7753 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7754 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7755 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7756 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7757 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7758 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7759 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
7760 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
7761 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
7762{
7763 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7764 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7765 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7766 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7767 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7768 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7769 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
7770 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
7771 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
7772}
7773#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9
7774
7775#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10
7776template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7777template <class t_ARGS_01,
7778 class t_ARGS_02,
7779 class t_ARGS_03,
7780 class t_ARGS_04,
7781 class t_ARGS_05,
7782 class t_ARGS_06,
7783 class t_ARGS_07,
7784 class t_ARGS_08,
7785 class t_ARGS_09,
7786 class t_ARGS_10>
7787inline
7788Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7790 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7791 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7792 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7793 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7794 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7795 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7796 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
7797 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
7798 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
7799 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
7800{
7801 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7802 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7803 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7804 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7805 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7806 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7807 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
7808 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
7809 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
7810 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
7811}
7812#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10
7813
7814
7815# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
7816#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0
7817template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7818template <class t_INIT_LIST_TYPE>
7819inline
7820Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7822 std::initializer_list<t_INIT_LIST_TYPE> il)
7823{
7824 emplace(il);
7825}
7826#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0
7827
7828#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1
7829template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7830template <class t_INIT_LIST_TYPE, class t_ARGS_01>
7831inline
7832Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7834 std::initializer_list<t_INIT_LIST_TYPE> il,
7835 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
7836{
7837 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
7838}
7839#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1
7840
7841#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2
7842template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7843template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7844 class t_ARGS_02>
7845inline
7846Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7848 std::initializer_list<t_INIT_LIST_TYPE> il,
7849 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7850 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
7851{
7852 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7853 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
7854}
7855#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2
7856
7857#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3
7858template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7859template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7860 class t_ARGS_02,
7861 class t_ARGS_03>
7862inline
7863Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7865 std::initializer_list<t_INIT_LIST_TYPE> il,
7866 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7867 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7868 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
7869{
7870 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7871 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7872 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
7873}
7874#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3
7875
7876#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4
7877template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7878template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7879 class t_ARGS_02,
7880 class t_ARGS_03,
7881 class t_ARGS_04>
7882inline
7883Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7885 std::initializer_list<t_INIT_LIST_TYPE> il,
7886 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7887 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7888 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7889 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
7890{
7891 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7892 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7893 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7894 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
7895}
7896#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4
7897
7898#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5
7899template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7900template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7901 class t_ARGS_02,
7902 class t_ARGS_03,
7903 class t_ARGS_04,
7904 class t_ARGS_05>
7905inline
7906Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7908 std::initializer_list<t_INIT_LIST_TYPE> il,
7909 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7910 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7911 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7912 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7913 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
7914{
7915 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7916 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7917 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7918 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7919 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
7920}
7921#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5
7922
7923#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6
7924template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7925template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7926 class t_ARGS_02,
7927 class t_ARGS_03,
7928 class t_ARGS_04,
7929 class t_ARGS_05,
7930 class t_ARGS_06>
7931inline
7932Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7934 std::initializer_list<t_INIT_LIST_TYPE> il,
7935 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7936 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7937 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7938 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7939 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7940 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
7941{
7942 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7943 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7944 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7945 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7946 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7947 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
7948}
7949#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6
7950
7951#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7
7952template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7953template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7954 class t_ARGS_02,
7955 class t_ARGS_03,
7956 class t_ARGS_04,
7957 class t_ARGS_05,
7958 class t_ARGS_06,
7959 class t_ARGS_07>
7960inline
7961Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7963 std::initializer_list<t_INIT_LIST_TYPE> il,
7964 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7965 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7966 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7967 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
7968 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
7969 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
7970 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
7971{
7972 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
7973 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
7974 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
7975 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
7976 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
7977 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
7978 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
7979}
7980#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7
7981
7982#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8
7983template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
7984template <class t_INIT_LIST_TYPE, class t_ARGS_01,
7985 class t_ARGS_02,
7986 class t_ARGS_03,
7987 class t_ARGS_04,
7988 class t_ARGS_05,
7989 class t_ARGS_06,
7990 class t_ARGS_07,
7991 class t_ARGS_08>
7992inline
7993Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
7995 std::initializer_list<t_INIT_LIST_TYPE> il,
7996 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
7997 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
7998 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
7999 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8000 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8001 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8002 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8003 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
8004{
8005 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8006 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8007 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8008 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8009 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8010 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8011 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8012 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
8013}
8014#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8
8015
8016#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9
8017template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8018template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8019 class t_ARGS_02,
8020 class t_ARGS_03,
8021 class t_ARGS_04,
8022 class t_ARGS_05,
8023 class t_ARGS_06,
8024 class t_ARGS_07,
8025 class t_ARGS_08,
8026 class t_ARGS_09>
8027inline
8028Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8030 std::initializer_list<t_INIT_LIST_TYPE> il,
8031 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8032 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8033 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8034 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8035 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8036 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8037 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8038 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
8039 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
8040{
8041 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8042 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8043 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8044 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8045 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8046 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8047 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8048 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
8049 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
8050}
8051#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9
8052
8053#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10
8054template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8055template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8056 class t_ARGS_02,
8057 class t_ARGS_03,
8058 class t_ARGS_04,
8059 class t_ARGS_05,
8060 class t_ARGS_06,
8061 class t_ARGS_07,
8062 class t_ARGS_08,
8063 class t_ARGS_09,
8064 class t_ARGS_10>
8065inline
8066Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8068 std::initializer_list<t_INIT_LIST_TYPE> il,
8069 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8070 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8071 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8072 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8073 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8074 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8075 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8076 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
8077 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
8078 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
8079{
8080 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8081 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8082 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8083 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8084 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8085 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8086 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8087 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
8088 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
8089 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
8090}
8091#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10
8092
8093# endif
8094#else
8095// The generated code below is a workaround for the absence of perfect
8096// forwarding in some compilers.
8097template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8098template <class... t_ARGS>
8099inline
8100Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8102 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
8103{
8104 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
8105}
8106
8107# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
8108template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8109template <class t_INIT_LIST_TYPE, class... t_ARGS>
8110inline
8111Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8113 std::initializer_list<t_INIT_LIST_TYPE> il,
8114 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
8115{
8116 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
8117}
8118# endif
8119// }}} END GENERATED CODE
8120#endif
8121
8122template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8123inline
8124Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8125 bsl::allocator_arg_t,
8126 allocator_type allocator)
8127: d_allocator(allocator)
8128{
8129}
8130
8131template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8132inline
8133Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8134 bsl::allocator_arg_t,
8135 allocator_type allocator,
8137: d_allocator(allocator)
8138{
8139}
8140
8141template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8142inline
8143Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8144 bsl::allocator_arg_t,
8145 allocator_type allocator,
8146 const Optional_Base& original)
8147: d_allocator(allocator)
8148{
8149 if (original.has_value()) {
8150 emplace(*original);
8151 }
8152}
8153
8154template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8155inline
8156Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8157 bsl::allocator_arg_t,
8158 allocator_type allocator,
8159 BloombergLP::bslmf::MovableRef<Optional_Base> original)
8160: d_allocator(allocator)
8161{
8162 Optional_Base& lvalue = original;
8163
8164 if (lvalue.has_value()) {
8165 emplace(MoveUtil::move(*lvalue));
8166 }
8167}
8168
8169template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8170template <class t_ANY_TYPE>
8171inline
8172Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8173 bsl::allocator_arg_t,
8174 allocator_type allocator,
8175 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
8176 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
8177: d_allocator(allocator)
8178{
8179 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value));
8180}
8181
8182template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8183template <class t_ANY_TYPE>
8184inline
8185Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8186 bsl::allocator_arg_t,
8187 allocator_type allocator,
8188 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
8189 const Optional_Base<t_ANY_TYPE>& original)
8190: d_allocator(allocator)
8191{
8192 if (original.has_value()) {
8193 emplace(original.value());
8194 }
8195}
8196
8197template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8198template <class t_ANY_TYPE>
8199inline
8200Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8201 bsl::allocator_arg_t,
8202 allocator_type allocator,
8203 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
8204 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original)
8205: d_allocator(allocator)
8206{
8207 Optional_Base<t_ANY_TYPE>& lvalue = original;
8208 if (lvalue.has_value()) {
8209 emplace(MoveUtil::move(*lvalue));
8210 }
8211}
8212
8213# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
8214template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8215template <class t_ANY_TYPE>
8216inline
8217Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8218 bsl::allocator_arg_t,
8219 allocator_type allocator,
8220 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
8221 const std::optional<t_ANY_TYPE>& original)
8222: d_allocator(allocator)
8223{
8224 if (original.has_value()) {
8225 emplace(original.value());
8226 }
8227}
8228
8229template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8230template <class t_ANY_TYPE>
8231inline
8232Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8233 bsl::allocator_arg_t,
8234 allocator_type allocator,
8235 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
8236 std::optional<t_ANY_TYPE>&& original)
8237: d_allocator(allocator)
8238{
8239 if (original.has_value()) {
8240 emplace(std::move(original.value()));
8241 }
8242}
8243# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
8244
8245#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
8246// {{{ BEGIN GENERATED CODE
8247// Command line: sim_cpp11_features.pl bslstl_optional.h
8248#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
8249#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
8250#endif
8251#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_N
8252#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_N BSLSTL_OPTIONAL_VARIADIC_LIMIT
8253#endif
8254#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0
8255template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8256inline
8257Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8258 bsl::allocator_arg_t,
8259 allocator_type alloc,
8261: d_allocator(alloc)
8262{
8263 emplace();
8264}
8265#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0
8266
8267#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1
8268template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8269template <class t_ARGS_01>
8270inline
8271Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8272 bsl::allocator_arg_t,
8273 allocator_type alloc,
8275 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
8276: d_allocator(alloc)
8277{
8278 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
8279}
8280#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1
8281
8282#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2
8283template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8284template <class t_ARGS_01,
8285 class t_ARGS_02>
8286inline
8287Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8288 bsl::allocator_arg_t,
8289 allocator_type alloc,
8291 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8292 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
8293: d_allocator(alloc)
8294{
8295 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8296 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
8297}
8298#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2
8299
8300#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3
8301template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8302template <class t_ARGS_01,
8303 class t_ARGS_02,
8304 class t_ARGS_03>
8305inline
8306Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8307 bsl::allocator_arg_t,
8308 allocator_type alloc,
8310 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8311 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8312 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
8313: d_allocator(alloc)
8314{
8315 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8316 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8317 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
8318}
8319#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3
8320
8321#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4
8322template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8323template <class t_ARGS_01,
8324 class t_ARGS_02,
8325 class t_ARGS_03,
8326 class t_ARGS_04>
8327inline
8328Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8329 bsl::allocator_arg_t,
8330 allocator_type alloc,
8332 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8333 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8334 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8335 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
8336: d_allocator(alloc)
8337{
8338 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8339 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8340 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8341 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
8342}
8343#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4
8344
8345#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5
8346template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8347template <class t_ARGS_01,
8348 class t_ARGS_02,
8349 class t_ARGS_03,
8350 class t_ARGS_04,
8351 class t_ARGS_05>
8352inline
8353Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8354 bsl::allocator_arg_t,
8355 allocator_type alloc,
8357 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8358 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8359 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8360 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8361 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
8362: d_allocator(alloc)
8363{
8364 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8365 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8366 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8367 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8368 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
8369}
8370#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5
8371
8372#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6
8373template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8374template <class t_ARGS_01,
8375 class t_ARGS_02,
8376 class t_ARGS_03,
8377 class t_ARGS_04,
8378 class t_ARGS_05,
8379 class t_ARGS_06>
8380inline
8381Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8382 bsl::allocator_arg_t,
8383 allocator_type alloc,
8385 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8386 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8387 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8388 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8389 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8390 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
8391: d_allocator(alloc)
8392{
8393 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8394 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8395 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8396 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8397 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8398 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
8399}
8400#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6
8401
8402#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7
8403template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8404template <class t_ARGS_01,
8405 class t_ARGS_02,
8406 class t_ARGS_03,
8407 class t_ARGS_04,
8408 class t_ARGS_05,
8409 class t_ARGS_06,
8410 class t_ARGS_07>
8411inline
8412Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8413 bsl::allocator_arg_t,
8414 allocator_type alloc,
8416 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8417 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8418 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8419 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8420 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8421 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8422 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
8423: d_allocator(alloc)
8424{
8425 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8426 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8427 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8428 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8429 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8430 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8431 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
8432}
8433#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7
8434
8435#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8
8436template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8437template <class t_ARGS_01,
8438 class t_ARGS_02,
8439 class t_ARGS_03,
8440 class t_ARGS_04,
8441 class t_ARGS_05,
8442 class t_ARGS_06,
8443 class t_ARGS_07,
8444 class t_ARGS_08>
8445inline
8446Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8447 bsl::allocator_arg_t,
8448 allocator_type alloc,
8450 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8451 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8452 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8453 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8454 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8455 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8456 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8457 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
8458: d_allocator(alloc)
8459{
8460 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8461 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8462 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8463 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8464 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8465 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8466 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8467 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
8468}
8469#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8
8470
8471#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9
8472template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8473template <class t_ARGS_01,
8474 class t_ARGS_02,
8475 class t_ARGS_03,
8476 class t_ARGS_04,
8477 class t_ARGS_05,
8478 class t_ARGS_06,
8479 class t_ARGS_07,
8480 class t_ARGS_08,
8481 class t_ARGS_09>
8482inline
8483Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8484 bsl::allocator_arg_t,
8485 allocator_type alloc,
8487 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8488 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8489 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8490 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8491 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8492 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8493 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8494 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
8495 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
8496: d_allocator(alloc)
8497{
8498 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8499 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8500 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8501 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8502 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8503 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8504 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8505 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
8506 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
8507}
8508#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9
8509
8510#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10
8511template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8512template <class t_ARGS_01,
8513 class t_ARGS_02,
8514 class t_ARGS_03,
8515 class t_ARGS_04,
8516 class t_ARGS_05,
8517 class t_ARGS_06,
8518 class t_ARGS_07,
8519 class t_ARGS_08,
8520 class t_ARGS_09,
8521 class t_ARGS_10>
8522inline
8523Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8524 bsl::allocator_arg_t,
8525 allocator_type alloc,
8527 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8528 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8529 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8530 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8531 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8532 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8533 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8534 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
8535 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
8536 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
8537: d_allocator(alloc)
8538{
8539 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8540 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8541 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8542 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8543 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8544 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8545 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8546 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
8547 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
8548 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
8549}
8550#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10
8551
8552
8553# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
8554#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0
8555template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8556template <class t_INIT_LIST_TYPE>
8557inline
8558Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8559 bsl::allocator_arg_t,
8560 allocator_type alloc,
8562 std::initializer_list<t_INIT_LIST_TYPE> il)
8563: d_allocator(alloc)
8564{
8565 emplace(il);
8566}
8567#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0
8568
8569#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1
8570template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8571template <class t_INIT_LIST_TYPE, class t_ARGS_01>
8572inline
8573Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8574 bsl::allocator_arg_t,
8575 allocator_type alloc,
8577 std::initializer_list<t_INIT_LIST_TYPE> il,
8578 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
8579: d_allocator(alloc)
8580{
8581 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
8582}
8583#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1
8584
8585#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2
8586template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8587template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8588 class t_ARGS_02>
8589inline
8590Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8591 bsl::allocator_arg_t,
8592 allocator_type alloc,
8594 std::initializer_list<t_INIT_LIST_TYPE> il,
8595 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8596 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
8597: d_allocator(alloc)
8598{
8599 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8600 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
8601}
8602#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2
8603
8604#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3
8605template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8606template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8607 class t_ARGS_02,
8608 class t_ARGS_03>
8609inline
8610Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8611 bsl::allocator_arg_t,
8612 allocator_type alloc,
8614 std::initializer_list<t_INIT_LIST_TYPE> il,
8615 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8616 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8617 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
8618: d_allocator(alloc)
8619{
8620 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8621 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8622 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
8623}
8624#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3
8625
8626#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4
8627template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8628template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8629 class t_ARGS_02,
8630 class t_ARGS_03,
8631 class t_ARGS_04>
8632inline
8633Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8634 bsl::allocator_arg_t,
8635 allocator_type alloc,
8637 std::initializer_list<t_INIT_LIST_TYPE> il,
8638 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8639 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8640 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8641 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
8642: d_allocator(alloc)
8643{
8644 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8645 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8646 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8647 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
8648}
8649#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4
8650
8651#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5
8652template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8653template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8654 class t_ARGS_02,
8655 class t_ARGS_03,
8656 class t_ARGS_04,
8657 class t_ARGS_05>
8658inline
8659Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8660 bsl::allocator_arg_t,
8661 allocator_type alloc,
8663 std::initializer_list<t_INIT_LIST_TYPE> il,
8664 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8665 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8666 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8667 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8668 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
8669: d_allocator(alloc)
8670{
8671 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8672 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8673 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8674 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8675 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
8676}
8677#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5
8678
8679#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6
8680template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8681template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8682 class t_ARGS_02,
8683 class t_ARGS_03,
8684 class t_ARGS_04,
8685 class t_ARGS_05,
8686 class t_ARGS_06>
8687inline
8688Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8689 bsl::allocator_arg_t,
8690 allocator_type alloc,
8692 std::initializer_list<t_INIT_LIST_TYPE> il,
8693 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8694 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8695 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8696 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8697 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8698 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
8699: d_allocator(alloc)
8700{
8701 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8702 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8703 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8704 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8705 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8706 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
8707}
8708#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6
8709
8710#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7
8711template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8712template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8713 class t_ARGS_02,
8714 class t_ARGS_03,
8715 class t_ARGS_04,
8716 class t_ARGS_05,
8717 class t_ARGS_06,
8718 class t_ARGS_07>
8719inline
8720Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8721 bsl::allocator_arg_t,
8722 allocator_type alloc,
8724 std::initializer_list<t_INIT_LIST_TYPE> il,
8725 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8726 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8727 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8728 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8729 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8730 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8731 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
8732: d_allocator(alloc)
8733{
8734 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8735 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8736 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8737 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8738 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8739 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8740 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
8741}
8742#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7
8743
8744#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8
8745template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8746template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8747 class t_ARGS_02,
8748 class t_ARGS_03,
8749 class t_ARGS_04,
8750 class t_ARGS_05,
8751 class t_ARGS_06,
8752 class t_ARGS_07,
8753 class t_ARGS_08>
8754inline
8755Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8756 bsl::allocator_arg_t,
8757 allocator_type alloc,
8759 std::initializer_list<t_INIT_LIST_TYPE> il,
8760 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8761 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8762 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8763 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8764 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8765 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8766 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8767 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
8768: d_allocator(alloc)
8769{
8770 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8771 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8772 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8773 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8774 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8775 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8776 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8777 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
8778}
8779#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8
8780
8781#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9
8782template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8783template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8784 class t_ARGS_02,
8785 class t_ARGS_03,
8786 class t_ARGS_04,
8787 class t_ARGS_05,
8788 class t_ARGS_06,
8789 class t_ARGS_07,
8790 class t_ARGS_08,
8791 class t_ARGS_09>
8792inline
8793Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8794 bsl::allocator_arg_t,
8795 allocator_type alloc,
8797 std::initializer_list<t_INIT_LIST_TYPE> il,
8798 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8799 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8800 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8801 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8802 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8803 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8804 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8805 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
8806 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
8807: d_allocator(alloc)
8808{
8809 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8810 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8811 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8812 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8813 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8814 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8815 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8816 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
8817 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
8818}
8819#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9
8820
8821#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10
8822template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8823template <class t_INIT_LIST_TYPE, class t_ARGS_01,
8824 class t_ARGS_02,
8825 class t_ARGS_03,
8826 class t_ARGS_04,
8827 class t_ARGS_05,
8828 class t_ARGS_06,
8829 class t_ARGS_07,
8830 class t_ARGS_08,
8831 class t_ARGS_09,
8832 class t_ARGS_10>
8833inline
8834Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8835 bsl::allocator_arg_t,
8836 allocator_type alloc,
8838 std::initializer_list<t_INIT_LIST_TYPE> il,
8839 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8840 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8841 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
8842 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
8843 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
8844 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
8845 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
8846 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
8847 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
8848 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
8849: d_allocator(alloc)
8850{
8851 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8852 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8853 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
8854 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
8855 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
8856 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
8857 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
8858 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
8859 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
8860 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
8861}
8862#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10
8863
8864# endif
8865#else
8866// The generated code below is a workaround for the absence of perfect
8867// forwarding in some compilers.
8868template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8869template <class... t_ARGS>
8870inline
8871Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8872 bsl::allocator_arg_t,
8873 allocator_type alloc,
8875 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
8876: d_allocator(alloc)
8877{
8878 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
8879}
8880
8881# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
8882template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8883template <class t_INIT_LIST_TYPE, class... t_ARGS>
8884inline
8885Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
8886 bsl::allocator_arg_t,
8887 allocator_type alloc,
8889 std::initializer_list<t_INIT_LIST_TYPE> il,
8890 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
8891: d_allocator(alloc)
8892{
8893 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
8894}
8895# endif
8896// }}} END GENERATED CODE
8897#endif
8898
8899// PROTECTED MANIPULATORS
8900template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8901template <class t_ANY_TYPE>
8902void Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::assignOrEmplace(
8903 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) rhs)
8904{
8905 if (has_value()) {
8906 d_value.value() = BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, rhs);
8907 } else {
8908 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, rhs));
8909 }
8910}
8911
8912# ifndef BDE_OMIT_INTERNAL_DEPRECATED
8913template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8914t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::dereferenceRaw()
8915{
8916 // This method is provided for the purpose of allowing 'NullableValue' to
8917 // determine the assert level in its value() method. Do not assert here.
8918
8919 return d_value.value();
8920}
8921
8922// PROTECTED ACCESORS
8923template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8924const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::dereferenceRaw() const
8925{
8926 // This method is provided for the purpose of allowing 'NullableValue' to
8927 // determine the assert level in its value() method. Do not assert here.
8928
8929 return d_value.value();
8930}
8931# endif // BDE_OMIT_INTERNAL_DEPRECATED
8932
8933// MANIPULATORS
8934#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
8935// {{{ BEGIN GENERATED CODE
8936// Command line: sim_cpp11_features.pl bslstl_optional.h
8937#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
8938#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
8939#endif
8940#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_O
8941#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_O BSLSTL_OPTIONAL_VARIADIC_LIMIT
8942#endif
8943#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0
8944template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8945inline
8946t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
8947 )
8948{
8949 return d_value.emplace(d_allocator.mechanism());
8950}
8951#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0
8952
8953#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1
8954template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8955template <class t_ARGS_01>
8956inline
8957t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
8958 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
8959{
8960 return d_value.emplace(d_allocator.mechanism(),
8961 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
8962}
8963#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1
8964
8965#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2
8966template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8967template <class t_ARGS_01,
8968 class t_ARGS_02>
8969inline
8970t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
8971 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8972 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
8973{
8974 return d_value.emplace(d_allocator.mechanism(),
8975 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8976 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
8977}
8978#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2
8979
8980#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3
8981template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
8982template <class t_ARGS_01,
8983 class t_ARGS_02,
8984 class t_ARGS_03>
8985inline
8986t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
8987 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
8988 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
8989 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
8990{
8991 return d_value.emplace(d_allocator.mechanism(),
8992 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
8993 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
8994 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
8995}
8996#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3
8997
8998#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4
8999template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9000template <class t_ARGS_01,
9001 class t_ARGS_02,
9002 class t_ARGS_03,
9003 class t_ARGS_04>
9004inline
9005t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9006 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9007 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9008 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9009 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
9010{
9011 return d_value.emplace(d_allocator.mechanism(),
9012 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9013 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9014 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9015 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
9016}
9017#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4
9018
9019#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5
9020template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9021template <class t_ARGS_01,
9022 class t_ARGS_02,
9023 class t_ARGS_03,
9024 class t_ARGS_04,
9025 class t_ARGS_05>
9026inline
9027t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9028 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9029 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9030 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9031 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9032 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
9033{
9034 return d_value.emplace(d_allocator.mechanism(),
9035 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9036 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9037 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9038 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9039 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
9040}
9041#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5
9042
9043#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6
9044template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9045template <class t_ARGS_01,
9046 class t_ARGS_02,
9047 class t_ARGS_03,
9048 class t_ARGS_04,
9049 class t_ARGS_05,
9050 class t_ARGS_06>
9051inline
9052t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9053 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9054 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9055 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9056 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9057 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9058 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
9059{
9060 return d_value.emplace(d_allocator.mechanism(),
9061 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9062 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9063 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9064 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9065 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9066 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
9067}
9068#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6
9069
9070#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7
9071template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9072template <class t_ARGS_01,
9073 class t_ARGS_02,
9074 class t_ARGS_03,
9075 class t_ARGS_04,
9076 class t_ARGS_05,
9077 class t_ARGS_06,
9078 class t_ARGS_07>
9079inline
9080t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9081 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9082 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9083 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9084 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9085 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9086 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
9087 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
9088{
9089 return d_value.emplace(d_allocator.mechanism(),
9090 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9091 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9092 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9093 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9094 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9095 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
9096 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
9097}
9098#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7
9099
9100#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8
9101template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9102template <class t_ARGS_01,
9103 class t_ARGS_02,
9104 class t_ARGS_03,
9105 class t_ARGS_04,
9106 class t_ARGS_05,
9107 class t_ARGS_06,
9108 class t_ARGS_07,
9109 class t_ARGS_08>
9110inline
9111t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9112 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9113 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9114 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9115 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9116 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9117 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
9118 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
9119 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
9120{
9121 return d_value.emplace(d_allocator.mechanism(),
9122 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9123 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9124 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9125 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9126 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9127 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
9128 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
9129 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
9130}
9131#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8
9132
9133#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9
9134template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9135template <class t_ARGS_01,
9136 class t_ARGS_02,
9137 class t_ARGS_03,
9138 class t_ARGS_04,
9139 class t_ARGS_05,
9140 class t_ARGS_06,
9141 class t_ARGS_07,
9142 class t_ARGS_08,
9143 class t_ARGS_09>
9144inline
9145t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9146 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9147 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9148 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9149 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9150 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9151 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
9152 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
9153 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
9154 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
9155{
9156 return d_value.emplace(d_allocator.mechanism(),
9157 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9158 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9159 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9160 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9161 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9162 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
9163 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
9164 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
9165 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
9166}
9167#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9
9168
9169#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10
9170template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9171template <class t_ARGS_01,
9172 class t_ARGS_02,
9173 class t_ARGS_03,
9174 class t_ARGS_04,
9175 class t_ARGS_05,
9176 class t_ARGS_06,
9177 class t_ARGS_07,
9178 class t_ARGS_08,
9179 class t_ARGS_09,
9180 class t_ARGS_10>
9181inline
9182t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9183 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9184 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9185 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9186 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9187 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9188 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
9189 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
9190 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
9191 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
9192 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
9193{
9194 return d_value.emplace(d_allocator.mechanism(),
9195 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9196 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9197 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9198 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9199 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9200 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
9201 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
9202 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
9203 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
9204 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
9205}
9206#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10
9207
9208
9209# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
9210#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0
9211template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9212template <class t_INIT_LIST_TYPE>
9213t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9214 std::initializer_list<t_INIT_LIST_TYPE> il)
9215{
9216 return d_value.emplace(d_allocator.mechanism(),
9217 il);
9218}
9219#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0
9220
9221#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1
9222template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9223template <class t_INIT_LIST_TYPE, class t_ARGS_01>
9224t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9225 std::initializer_list<t_INIT_LIST_TYPE> il,
9226 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
9227{
9228 return d_value.emplace(d_allocator.mechanism(),
9229 il,
9230 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
9231}
9232#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1
9233
9234#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2
9235template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9236template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9237 class t_ARGS_02>
9238t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9239 std::initializer_list<t_INIT_LIST_TYPE> il,
9240 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9241 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
9242{
9243 return d_value.emplace(d_allocator.mechanism(),
9244 il,
9245 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9246 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
9247}
9248#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2
9249
9250#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3
9251template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9252template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9253 class t_ARGS_02,
9254 class t_ARGS_03>
9255t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9256 std::initializer_list<t_INIT_LIST_TYPE> il,
9257 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9258 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9259 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
9260{
9261 return d_value.emplace(d_allocator.mechanism(),
9262 il,
9263 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9264 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9265 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
9266}
9267#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3
9268
9269#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4
9270template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9271template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9272 class t_ARGS_02,
9273 class t_ARGS_03,
9274 class t_ARGS_04>
9275t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9276 std::initializer_list<t_INIT_LIST_TYPE> il,
9277 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9278 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9279 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9280 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
9281{
9282 return d_value.emplace(d_allocator.mechanism(),
9283 il,
9284 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9285 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9286 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9287 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
9288}
9289#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4
9290
9291#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5
9292template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9293template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9294 class t_ARGS_02,
9295 class t_ARGS_03,
9296 class t_ARGS_04,
9297 class t_ARGS_05>
9298t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9299 std::initializer_list<t_INIT_LIST_TYPE> il,
9300 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9301 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9302 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9303 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9304 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
9305{
9306 return d_value.emplace(d_allocator.mechanism(),
9307 il,
9308 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9309 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9310 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9311 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9312 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
9313}
9314#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5
9315
9316#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6
9317template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9318template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9319 class t_ARGS_02,
9320 class t_ARGS_03,
9321 class t_ARGS_04,
9322 class t_ARGS_05,
9323 class t_ARGS_06>
9324t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9325 std::initializer_list<t_INIT_LIST_TYPE> il,
9326 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9327 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9328 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9329 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9330 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9331 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
9332{
9333 return d_value.emplace(d_allocator.mechanism(),
9334 il,
9335 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9336 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9337 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9338 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9339 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9340 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
9341}
9342#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6
9343
9344#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7
9345template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9346template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9347 class t_ARGS_02,
9348 class t_ARGS_03,
9349 class t_ARGS_04,
9350 class t_ARGS_05,
9351 class t_ARGS_06,
9352 class t_ARGS_07>
9353t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9354 std::initializer_list<t_INIT_LIST_TYPE> il,
9355 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9356 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9357 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9358 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9359 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9360 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
9361 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
9362{
9363 return d_value.emplace(d_allocator.mechanism(),
9364 il,
9365 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9366 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9367 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9368 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9369 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9370 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
9371 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
9372}
9373#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7
9374
9375#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8
9376template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9377template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9378 class t_ARGS_02,
9379 class t_ARGS_03,
9380 class t_ARGS_04,
9381 class t_ARGS_05,
9382 class t_ARGS_06,
9383 class t_ARGS_07,
9384 class t_ARGS_08>
9385t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9386 std::initializer_list<t_INIT_LIST_TYPE> il,
9387 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9388 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9389 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9390 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9391 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9392 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
9393 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
9394 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
9395{
9396 return d_value.emplace(d_allocator.mechanism(),
9397 il,
9398 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9399 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9400 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9401 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9402 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9403 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
9404 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
9405 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
9406}
9407#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8
9408
9409#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9
9410template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9411template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9412 class t_ARGS_02,
9413 class t_ARGS_03,
9414 class t_ARGS_04,
9415 class t_ARGS_05,
9416 class t_ARGS_06,
9417 class t_ARGS_07,
9418 class t_ARGS_08,
9419 class t_ARGS_09>
9420t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9421 std::initializer_list<t_INIT_LIST_TYPE> il,
9422 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9423 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9424 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9425 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9426 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9427 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
9428 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
9429 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
9430 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
9431{
9432 return d_value.emplace(d_allocator.mechanism(),
9433 il,
9434 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9435 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9436 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9437 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9438 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9439 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
9440 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
9441 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
9442 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
9443}
9444#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9
9445
9446#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10
9447template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9448template <class t_INIT_LIST_TYPE, class t_ARGS_01,
9449 class t_ARGS_02,
9450 class t_ARGS_03,
9451 class t_ARGS_04,
9452 class t_ARGS_05,
9453 class t_ARGS_06,
9454 class t_ARGS_07,
9455 class t_ARGS_08,
9456 class t_ARGS_09,
9457 class t_ARGS_10>
9458t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9459 std::initializer_list<t_INIT_LIST_TYPE> il,
9460 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
9461 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
9462 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
9463 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
9464 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
9465 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
9466 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
9467 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
9468 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
9469 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
9470{
9471 return d_value.emplace(d_allocator.mechanism(),
9472 il,
9473 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
9474 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
9475 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
9476 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
9477 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
9478 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
9479 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
9480 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
9481 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
9482 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
9483}
9484#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10
9485
9486# endif
9487#else
9488// The generated code below is a workaround for the absence of perfect
9489// forwarding in some compilers.
9490template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9491template <class... t_ARGS>
9492inline
9493t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9494 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
9495{
9496 return d_value.emplace(d_allocator.mechanism(),
9497 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
9498}
9499
9500# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
9501template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9502template <class t_INIT_LIST_TYPE, class... t_ARGS>
9503t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
9504 std::initializer_list<t_INIT_LIST_TYPE> il,
9505 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
9506{
9507 return d_value.emplace(d_allocator.mechanism(),
9508 il,
9509 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
9510}
9511# endif
9512// }}} END GENERATED CODE
9513#endif
9514
9515template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9516inline
9517void Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::reset() BSLS_KEYWORD_NOEXCEPT
9518{
9519 d_value.reset();
9520}
9521
9522template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9523void Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::swap(Optional_Base& other)
9526 bsl::is_nothrow_swappable<t_TYPE>::value)
9527{
9528 BSLS_ASSERT(d_allocator == other.d_allocator);
9529
9530 if (this->has_value() && other.has_value()) {
9531 BloombergLP::bslalg::SwapUtil::swap(
9532 BSLS_UTIL_ADDRESSOF(d_value.value()),
9533 BSLS_UTIL_ADDRESSOF(*other));
9534 }
9535 else if (this->has_value()) {
9536 other.emplace(MoveUtil::move(d_value.value()));
9537 this->reset();
9538 }
9539 else if (other.has_value()) {
9540 this->emplace(MoveUtil::move(*other));
9541 other.reset();
9542 }
9543}
9544
9545# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9546template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9547inline
9548t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() &
9549{
9550 if (!has_value())
9551 BSLS_THROW(bsl::bad_optional_access());
9552
9553 return d_value.value();
9554}
9555
9556template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9557inline
9558t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() &&
9559{
9560 if (!has_value())
9561 BSLS_THROW(bsl::bad_optional_access());
9562
9563 return std::move(d_value.value());
9564}
9565
9566# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9567template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9568inline
9569t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value()
9570{
9571 if (!has_value())
9572 BSLS_THROW(bsl::bad_optional_access());
9573
9574 return d_value.value();
9575}
9576
9577# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
9578
9579# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9580template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9581template <class t_ANY_TYPE>
9582inline
9583t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
9584 t_ANY_TYPE&& value) &&
9585{
9586 if (has_value()) {
9587 return t_TYPE(std::move(d_value.value())); // RETURN
9588 }
9589 else {
9590 return t_TYPE(std::forward<t_ANY_TYPE>(value)); // RETURN
9591 }
9592}
9593
9594# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
9595template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9596template <class t_ANY_TYPE>
9597inline
9598t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
9599 bsl::allocator_arg_t,
9600 allocator_type allocator,
9601 t_ANY_TYPE&& value) &&
9602{
9603 if (has_value()) {
9604 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
9605 allocator,
9606 std::move(d_value.value())); // RETURN
9607 }
9608 else {
9609 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
9610 allocator,
9611 std::forward<t_ANY_TYPE>(value)); // RETURN
9612 }
9613}
9614# endif // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
9615# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9616
9617template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9618inline
9619Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>&
9620Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator=(const Optional_Base& rhs)
9621{
9622 if (rhs.has_value()) {
9623 if (this->has_value()) {
9624 d_value.value() = *rhs;
9625 }
9626 else {
9627 emplace(*rhs);
9628 }
9629 }
9630 else {
9631 reset();
9632 }
9633 return *this;
9634}
9635
9636template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9637inline
9638Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>&
9639Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator=(
9640 BloombergLP::bslmf::MovableRef<Optional_Base> rhs)
9641{
9642 Optional_Base& lvalue = rhs;
9643
9644 if (lvalue.has_value()) {
9645 if (this->has_value()) {
9646 d_value.value() = MoveUtil::move(*lvalue);
9647 }
9648 else {
9649 emplace(MoveUtil::move(*lvalue));
9650 }
9651 }
9652 else {
9653 reset();
9654 }
9655 return *this;
9656}
9657
9658template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9659inline
9660t_TYPE *Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator->()
9661{
9662 BSLS_ASSERT(has_value());
9663
9664 return BSLS_UTIL_ADDRESSOF(d_value.value());
9665}
9666
9667# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9668template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9669inline
9670t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() &
9671{
9672 BSLS_ASSERT(has_value());
9673
9674 return d_value.value();
9675}
9676
9677template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9678inline
9679t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() &&
9680{
9681 BSLS_ASSERT(has_value());
9682
9683 return std::move(d_value.value());
9684}
9685
9686# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9687template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9688inline
9689t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*()
9690{
9691 BSLS_ASSERT(has_value());
9692
9693 return d_value.value();
9694}
9695
9696# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
9697
9698// ACCESSORS
9699
9700template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9701inline
9702typename Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::allocator_type
9703Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::get_allocator() const
9705{
9706 return d_allocator;
9707}
9708
9709template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9710inline
9711bool
9712Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::has_value() const
9714{
9715 return d_value.hasValue();
9716}
9717
9718# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9719template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9720inline
9721const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() const&
9722{
9723 if (!has_value())
9724 BSLS_THROW(bsl::bad_optional_access());
9725
9726 return d_value.value();
9727}
9728
9729template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9730inline
9731const t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() const&&
9732{
9733 if (!has_value())
9734 BSLS_THROW(bsl::bad_optional_access());
9735
9736 return std::move(d_value.value());
9737}
9738
9739# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9740template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9741inline
9742const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() const
9743{
9744 if (!has_value())
9745 BSLS_THROW(bsl::bad_optional_access());
9746
9747 return d_value.value();
9748}
9749
9750# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
9751
9752# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9753template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9754template <class t_ANY_TYPE>
9755inline
9756t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
9757 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&
9758{
9759 if (has_value()) {
9760 return t_TYPE(d_value.value()); // RETURN
9761 }
9762 else {
9763 return t_TYPE(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE,
9764 value)); // RETURN
9765 }
9766}
9767
9768# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
9769template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9770template <class t_ANY_TYPE>
9771inline
9772t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
9773 bsl::allocator_arg_t,
9774 allocator_type allocator,
9775 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&
9776{
9777 if (has_value()) {
9778 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
9779 allocator, d_value.value()); // RETURN
9780 }
9781 else {
9782 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
9783 allocator,
9784 BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value)); // RETURN
9785 }
9786}
9787# endif // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
9788# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9789template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9790template <class t_ANY_TYPE>
9791inline
9792t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
9793 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const
9794{
9795 if (has_value()) {
9796 return t_TYPE(d_value.value()); // RETURN
9797 }
9798 else {
9799 return t_TYPE(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE,
9800 value)); // RETURN
9801 }
9802}
9803
9804# ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
9805template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9806template <class t_ANY_TYPE>
9807inline
9808t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
9809 bsl::allocator_arg_t,
9810 allocator_type allocator,
9811 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const
9812{
9813 if (has_value()) {
9814 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
9815 allocator, d_value.value()); // RETURN
9816 }
9817 else {
9818 return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
9819 allocator,
9820 BSLS_COMPILERFEATURES_FORWARD(ANY_TYPE, value)); // RETURN
9821 }
9822}
9823# endif // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
9824# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
9825
9826template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9827inline
9828const t_TYPE *Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator->() const
9829{
9830 BSLS_ASSERT(has_value());
9831
9832 return BSLS_UTIL_ADDRESSOF(d_value.value());
9833}
9834
9835# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9836template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9837inline
9838const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() const&
9839{
9840 BSLS_ASSERT(has_value());
9841
9842 return d_value.value();
9843}
9844
9845template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9846inline
9847const t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() const&&
9848{
9849 BSLS_ASSERT(has_value());
9850
9851 return std::move(d_value.value());
9852}
9853
9854# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
9855template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9856inline
9857const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() const
9858{
9859 BSLS_ASSERT(has_value());
9860
9861 return d_value.value();
9862}
9863# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
9864
9865#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
9866template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
9867Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator bool() const
9869{
9870 return has_value();
9871}
9872#endif // BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
9873
9874// ============================================================================
9875// Section: C++17 Allocator-Unaware 'Optional_Base' Method Definitions
9876// ============================================================================
9877
9878 // ==================================
9879 // class Optional_Base<t_TYPE, false>
9880 // ==================================
9881
9882# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
9883// PROTECTED CREATORS
9884template <class t_TYPE>
9885inline
9886Optional_Base<t_TYPE, false>::Optional_Base()
9887{
9888}
9889
9890template <class t_TYPE>
9891inline
9892Optional_Base<t_TYPE, false>::Optional_Base(bsl::nullopt_t)
9893{
9894}
9895
9896template <class t_TYPE>
9897template <class t_ANY_TYPE>
9898inline
9899Optional_Base<t_TYPE, false>::Optional_Base(
9900 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
9901 t_ANY_TYPE&& value)
9902: StdOptionalBase(std::forward<t_ANY_TYPE>(value))
9903{
9904}
9905
9906template <class t_TYPE>
9907template <class t_ANY_TYPE>
9908inline
9909Optional_Base<t_TYPE, false>::Optional_Base(
9910 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
9911 const Optional_Base<t_ANY_TYPE>& original)
9912{
9913 if (original.has_value()) {
9914 this->emplace(original.value());
9915 }
9916}
9917
9918template <class t_TYPE>
9919template <class t_ANY_TYPE>
9920inline
9921Optional_Base<t_TYPE, false>::Optional_Base(
9922 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
9923 Optional_Base<t_ANY_TYPE>&& original)
9924{
9925 if (original.has_value()) {
9926 this->emplace(std::move(original.value()));
9927 }
9928}
9929
9930template <class t_TYPE>
9931template <class t_ANY_TYPE>
9932inline
9933Optional_Base<t_TYPE, false>::Optional_Base(
9934 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
9935 const std::optional<t_ANY_TYPE>& original)
9936: StdOptionalBase(original)
9937{
9938}
9939
9940template <class t_TYPE>
9941template <class t_ANY_TYPE>
9942inline
9943Optional_Base<t_TYPE, false>::Optional_Base(
9944 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
9945 std::optional<t_ANY_TYPE>&& original)
9946: StdOptionalBase(std::move(original))
9947{
9948}
9949
9950template <class t_TYPE>
9951template <class... t_ARGS>
9952inline
9953Optional_Base<t_TYPE, false>::Optional_Base(bsl::in_place_t, t_ARGS&&... args)
9954: StdOptionalBase(bsl::in_place, std::forward<t_ARGS>(args)...)
9955{
9956}
9957
9958template <class t_TYPE>
9959template <class t_INIT_LIST_TYPE, class... t_ARGS>
9960inline
9961Optional_Base<t_TYPE, false>::Optional_Base(
9963 std::initializer_list<t_INIT_LIST_TYPE> il,
9964 t_ARGS&&... args)
9965: StdOptionalBase(bsl::in_place, il, std::forward<t_ARGS>(args)...)
9966{
9967}
9968
9969template <class t_TYPE>
9970inline
9971Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t, AllocType)
9972{
9973 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
9974}
9975
9976template <class t_TYPE>
9977inline
9978Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t,
9979 AllocType,
9981{
9982 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
9983}
9984
9985template <class t_TYPE>
9986template <class t_ANY_TYPE>
9987inline
9988Optional_Base<t_TYPE, false>::Optional_Base(
9989 bsl::allocator_arg_t,
9990 AllocType,
9991 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
9992 t_ANY_TYPE&&)
9993{
9994 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
9995}
9996
9997template <class t_TYPE>
9998template <class t_ANY_TYPE>
9999inline
10000Optional_Base<t_TYPE, false>::Optional_Base(
10001 bsl::allocator_arg_t,
10002 AllocType,
10003 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
10004 const Optional_Base<t_ANY_TYPE>&)
10005{
10006 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10007}
10008
10009template <class t_TYPE>
10010template <class t_ANY_TYPE>
10011inline
10012Optional_Base<t_TYPE, false>::Optional_Base(
10013 bsl::allocator_arg_t,
10014 AllocType,
10015 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
10016 Optional_Base<t_ANY_TYPE>&&)
10017{
10018 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10019}
10020
10021template <class t_TYPE>
10022template <class t_ANY_TYPE>
10023inline
10024Optional_Base<t_TYPE, false>::Optional_Base(
10025 bsl::allocator_arg_t,
10026 AllocType,
10027 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
10028 const std::optional<t_ANY_TYPE>&)
10029{
10030 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10031}
10032
10033template <class t_TYPE>
10034template <class t_ANY_TYPE>
10035inline
10036Optional_Base<t_TYPE, false>::Optional_Base(
10037 bsl::allocator_arg_t,
10038 AllocType,
10039 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
10040 std::optional<t_ANY_TYPE>&&)
10041{
10042 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10043}
10044
10045template <class t_TYPE>
10046template <class... t_ARGS>
10047inline
10048Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t,
10049 AllocType,
10051 t_ARGS&&...)
10052{
10053 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10054}
10055
10056template <class t_TYPE>
10057template <class t_INIT_LIST_TYPE, class... t_ARGS>
10058inline
10059Optional_Base<t_TYPE, false>::Optional_Base(
10060 bsl::allocator_arg_t,
10061 AllocType,
10063 std::initializer_list<t_INIT_LIST_TYPE>,
10065{
10066 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10067}
10068
10069// PROTECTED MANIPULATORS
10070template <class t_TYPE>
10071template <class t_ANY_TYPE>
10072void Optional_Base<t_TYPE, false>::assignOrEmplace(t_ANY_TYPE&& rhs)
10073{
10074 StdOptionalBase::operator=(std::forward<t_ANY_TYPE>(rhs));
10075}
10076
10077# ifndef BDE_OMIT_INTERNAL_DEPRECATED
10078template <class t_TYPE>
10079t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw()
10080{
10081 // This method is provided for the purpose of allowing 'NullableValue' to
10082 // determine the assert level in its value() method. Do not assert here.
10083
10084 return this->operator*();
10085
10086}
10087
10088// PROTECTED ACCESORS
10089template <class t_TYPE>
10090const t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw() const
10091{
10092 // This method is provided for the purpose of allowing 'NullableValue' to
10093 // determine the assert level in its value() method. Do not assert here.
10094
10095 return this->operator*();
10096
10097}
10098# endif // BDE_OMIT_INTERNAL_DEPRECATED
10099# else // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
10100
10101// ============================================================================
10102// Section: Pre-C++17 Allocator-Unaware 'Optional_Base' Method Definitions
10103// ============================================================================
10104
10105// PROTECTED CREATORS
10106template <class t_TYPE>
10107inline
10108Optional_Base<t_TYPE, false>::Optional_Base()
10109{
10110}
10111
10112template <class t_TYPE>
10113inline
10114Optional_Base<t_TYPE, false>::Optional_Base(bsl::nullopt_t)
10115{
10116}
10117
10118template <class t_TYPE>
10119inline
10120Optional_Base<t_TYPE, false>::Optional_Base(const Optional_Base& original)
10121{
10122 if (original.has_value()) {
10123 emplace(original.value());
10124 }
10125}
10126
10127template <class t_TYPE>
10128inline
10129Optional_Base<t_TYPE, false>::Optional_Base(
10130 BloombergLP::bslmf::MovableRef<Optional_Base> original)
10133{
10134 Optional_Base& lvalue = original;
10135
10136 if (lvalue.has_value()) {
10137 emplace(MoveUtil::move(*lvalue));
10138 }
10139}
10140
10141template <class t_TYPE>
10142template <class t_ANY_TYPE>
10143inline
10144Optional_Base<t_TYPE, false>::Optional_Base(
10145 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
10146 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
10147{
10148 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value));
10149}
10150
10151template <class t_TYPE>
10152template <class t_ANY_TYPE>
10153inline
10154Optional_Base<t_TYPE, false>::Optional_Base(
10155 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
10156 const Optional_Base<t_ANY_TYPE>& original)
10157{
10158 if (original.has_value()) {
10159 emplace(original.value());
10160 }
10161}
10162
10163template <class t_TYPE>
10164template <class t_ANY_TYPE>
10165inline
10166Optional_Base<t_TYPE, false>::Optional_Base(
10167 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
10168 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original)
10169{
10170 Optional_Base<t_ANY_TYPE>& lvalue = original;
10171 if (lvalue.has_value()) {
10172 emplace(MoveUtil::move(*lvalue));
10173 }
10174}
10175
10176#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
10177// {{{ BEGIN GENERATED CODE
10178// Command line: sim_cpp11_features.pl bslstl_optional.h
10179#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
10180#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
10181#endif
10182#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_P
10183#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_P BSLSTL_OPTIONAL_VARIADIC_LIMIT
10184#endif
10185#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0
10186template <class t_TYPE>
10187inline
10188Optional_Base<t_TYPE, false>::Optional_Base(
10190{
10191 emplace();
10192}
10193#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0
10194
10195#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1
10196template <class t_TYPE>
10197template <class t_ARGS_01>
10198inline
10199Optional_Base<t_TYPE, false>::Optional_Base(
10201 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
10202{
10203 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
10204}
10205#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1
10206
10207#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2
10208template <class t_TYPE>
10209template <class t_ARGS_01,
10210 class t_ARGS_02>
10211inline
10212Optional_Base<t_TYPE, false>::Optional_Base(
10214 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10215 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
10216{
10217 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10218 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
10219}
10220#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2
10221
10222#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3
10223template <class t_TYPE>
10224template <class t_ARGS_01,
10225 class t_ARGS_02,
10226 class t_ARGS_03>
10227inline
10228Optional_Base<t_TYPE, false>::Optional_Base(
10230 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10231 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10232 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
10233{
10234 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10235 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10236 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
10237}
10238#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3
10239
10240#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4
10241template <class t_TYPE>
10242template <class t_ARGS_01,
10243 class t_ARGS_02,
10244 class t_ARGS_03,
10245 class t_ARGS_04>
10246inline
10247Optional_Base<t_TYPE, false>::Optional_Base(
10249 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10250 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10251 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10252 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
10253{
10254 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10255 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10256 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10257 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
10258}
10259#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4
10260
10261#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5
10262template <class t_TYPE>
10263template <class t_ARGS_01,
10264 class t_ARGS_02,
10265 class t_ARGS_03,
10266 class t_ARGS_04,
10267 class t_ARGS_05>
10268inline
10269Optional_Base<t_TYPE, false>::Optional_Base(
10271 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10272 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10273 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10274 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10275 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
10276{
10277 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10278 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10279 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10280 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10281 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
10282}
10283#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5
10284
10285#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6
10286template <class t_TYPE>
10287template <class t_ARGS_01,
10288 class t_ARGS_02,
10289 class t_ARGS_03,
10290 class t_ARGS_04,
10291 class t_ARGS_05,
10292 class t_ARGS_06>
10293inline
10294Optional_Base<t_TYPE, false>::Optional_Base(
10296 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10297 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10298 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10299 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10300 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10301 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
10302{
10303 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10304 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10305 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10306 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10307 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10308 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
10309}
10310#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6
10311
10312#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7
10313template <class t_TYPE>
10314template <class t_ARGS_01,
10315 class t_ARGS_02,
10316 class t_ARGS_03,
10317 class t_ARGS_04,
10318 class t_ARGS_05,
10319 class t_ARGS_06,
10320 class t_ARGS_07>
10321inline
10322Optional_Base<t_TYPE, false>::Optional_Base(
10324 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10325 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10326 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10327 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10328 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10329 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
10330 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
10331{
10332 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10333 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10334 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10335 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10336 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10337 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
10338 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
10339}
10340#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7
10341
10342#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8
10343template <class t_TYPE>
10344template <class t_ARGS_01,
10345 class t_ARGS_02,
10346 class t_ARGS_03,
10347 class t_ARGS_04,
10348 class t_ARGS_05,
10349 class t_ARGS_06,
10350 class t_ARGS_07,
10351 class t_ARGS_08>
10352inline
10353Optional_Base<t_TYPE, false>::Optional_Base(
10355 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10356 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10357 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10358 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10359 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10360 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
10361 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
10362 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
10363{
10364 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10365 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10366 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10367 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10368 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10369 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
10370 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
10371 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
10372}
10373#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8
10374
10375#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9
10376template <class t_TYPE>
10377template <class t_ARGS_01,
10378 class t_ARGS_02,
10379 class t_ARGS_03,
10380 class t_ARGS_04,
10381 class t_ARGS_05,
10382 class t_ARGS_06,
10383 class t_ARGS_07,
10384 class t_ARGS_08,
10385 class t_ARGS_09>
10386inline
10387Optional_Base<t_TYPE, false>::Optional_Base(
10389 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10390 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10391 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10392 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10393 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10394 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
10395 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
10396 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
10397 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
10398{
10399 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10400 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10401 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10402 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10403 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10404 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
10405 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
10406 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
10407 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
10408}
10409#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9
10410
10411#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10
10412template <class t_TYPE>
10413template <class t_ARGS_01,
10414 class t_ARGS_02,
10415 class t_ARGS_03,
10416 class t_ARGS_04,
10417 class t_ARGS_05,
10418 class t_ARGS_06,
10419 class t_ARGS_07,
10420 class t_ARGS_08,
10421 class t_ARGS_09,
10422 class t_ARGS_10>
10423inline
10424Optional_Base<t_TYPE, false>::Optional_Base(
10426 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10427 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10428 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10429 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10430 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10431 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
10432 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
10433 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
10434 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
10435 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
10436{
10437 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10438 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10439 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10440 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10441 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10442 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
10443 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
10444 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
10445 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
10446 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
10447}
10448#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10
10449
10450
10451# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
10452#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0
10453template <class t_TYPE>
10454template <class t_INIT_LIST_TYPE>
10455inline
10456Optional_Base<t_TYPE, false>::Optional_Base(
10458 std::initializer_list<t_INIT_LIST_TYPE> il)
10459{
10460 emplace(il);
10461}
10462#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0
10463
10464#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1
10465template <class t_TYPE>
10466template <class t_INIT_LIST_TYPE, class t_ARGS_01>
10467inline
10468Optional_Base<t_TYPE, false>::Optional_Base(
10470 std::initializer_list<t_INIT_LIST_TYPE> il,
10471 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
10472{
10473 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
10474}
10475#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1
10476
10477#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2
10478template <class t_TYPE>
10479template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10480 class t_ARGS_02>
10481inline
10482Optional_Base<t_TYPE, false>::Optional_Base(
10484 std::initializer_list<t_INIT_LIST_TYPE> il,
10485 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10486 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
10487{
10488 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10489 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
10490}
10491#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2
10492
10493#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3
10494template <class t_TYPE>
10495template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10496 class t_ARGS_02,
10497 class t_ARGS_03>
10498inline
10499Optional_Base<t_TYPE, false>::Optional_Base(
10501 std::initializer_list<t_INIT_LIST_TYPE> il,
10502 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10503 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10504 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
10505{
10506 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10507 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10508 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
10509}
10510#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3
10511
10512#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4
10513template <class t_TYPE>
10514template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10515 class t_ARGS_02,
10516 class t_ARGS_03,
10517 class t_ARGS_04>
10518inline
10519Optional_Base<t_TYPE, false>::Optional_Base(
10521 std::initializer_list<t_INIT_LIST_TYPE> il,
10522 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10523 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10524 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10525 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
10526{
10527 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10528 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10529 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10530 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
10531}
10532#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4
10533
10534#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5
10535template <class t_TYPE>
10536template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10537 class t_ARGS_02,
10538 class t_ARGS_03,
10539 class t_ARGS_04,
10540 class t_ARGS_05>
10541inline
10542Optional_Base<t_TYPE, false>::Optional_Base(
10544 std::initializer_list<t_INIT_LIST_TYPE> il,
10545 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10546 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10547 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10548 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10549 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
10550{
10551 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10552 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10553 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10554 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10555 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
10556}
10557#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5
10558
10559#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6
10560template <class t_TYPE>
10561template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10562 class t_ARGS_02,
10563 class t_ARGS_03,
10564 class t_ARGS_04,
10565 class t_ARGS_05,
10566 class t_ARGS_06>
10567inline
10568Optional_Base<t_TYPE, false>::Optional_Base(
10570 std::initializer_list<t_INIT_LIST_TYPE> il,
10571 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10572 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10573 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10574 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10575 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10576 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
10577{
10578 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10579 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10580 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10581 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10582 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10583 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
10584}
10585#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6
10586
10587#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7
10588template <class t_TYPE>
10589template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10590 class t_ARGS_02,
10591 class t_ARGS_03,
10592 class t_ARGS_04,
10593 class t_ARGS_05,
10594 class t_ARGS_06,
10595 class t_ARGS_07>
10596inline
10597Optional_Base<t_TYPE, false>::Optional_Base(
10599 std::initializer_list<t_INIT_LIST_TYPE> il,
10600 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10601 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10602 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10603 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10604 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10605 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
10606 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
10607{
10608 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10609 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10610 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10611 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10612 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10613 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
10614 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
10615}
10616#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7
10617
10618#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8
10619template <class t_TYPE>
10620template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10621 class t_ARGS_02,
10622 class t_ARGS_03,
10623 class t_ARGS_04,
10624 class t_ARGS_05,
10625 class t_ARGS_06,
10626 class t_ARGS_07,
10627 class t_ARGS_08>
10628inline
10629Optional_Base<t_TYPE, false>::Optional_Base(
10631 std::initializer_list<t_INIT_LIST_TYPE> il,
10632 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10633 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10634 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10635 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10636 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10637 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
10638 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
10639 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
10640{
10641 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10642 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10643 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10644 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10645 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10646 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
10647 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
10648 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
10649}
10650#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8
10651
10652#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9
10653template <class t_TYPE>
10654template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10655 class t_ARGS_02,
10656 class t_ARGS_03,
10657 class t_ARGS_04,
10658 class t_ARGS_05,
10659 class t_ARGS_06,
10660 class t_ARGS_07,
10661 class t_ARGS_08,
10662 class t_ARGS_09>
10663inline
10664Optional_Base<t_TYPE, false>::Optional_Base(
10666 std::initializer_list<t_INIT_LIST_TYPE> il,
10667 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10668 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10669 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10670 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10671 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10672 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
10673 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
10674 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
10675 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
10676{
10677 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10678 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10679 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10680 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10681 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10682 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
10683 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
10684 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
10685 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
10686}
10687#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9
10688
10689#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10
10690template <class t_TYPE>
10691template <class t_INIT_LIST_TYPE, class t_ARGS_01,
10692 class t_ARGS_02,
10693 class t_ARGS_03,
10694 class t_ARGS_04,
10695 class t_ARGS_05,
10696 class t_ARGS_06,
10697 class t_ARGS_07,
10698 class t_ARGS_08,
10699 class t_ARGS_09,
10700 class t_ARGS_10>
10701inline
10702Optional_Base<t_TYPE, false>::Optional_Base(
10704 std::initializer_list<t_INIT_LIST_TYPE> il,
10705 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
10706 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
10707 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
10708 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
10709 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
10710 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
10711 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
10712 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
10713 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
10714 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
10715{
10716 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
10717 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
10718 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
10719 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
10720 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
10721 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
10722 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
10723 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
10724 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
10725 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
10726}
10727#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10
10728
10729# endif
10730#else
10731// The generated code below is a workaround for the absence of perfect
10732// forwarding in some compilers.
10733template <class t_TYPE>
10734template <class... t_ARGS>
10735inline
10736Optional_Base<t_TYPE, false>::Optional_Base(
10738 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
10739{
10740 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
10741}
10742
10743# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
10744template <class t_TYPE>
10745template <class t_INIT_LIST_TYPE, class... t_ARGS>
10746inline
10747Optional_Base<t_TYPE, false>::Optional_Base(
10749 std::initializer_list<t_INIT_LIST_TYPE> il,
10750 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
10751{
10752 emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
10753}
10754# endif
10755// }}} END GENERATED CODE
10756#endif
10757
10758template <class t_TYPE>
10759inline
10760Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t, AllocType)
10761{
10762 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10763}
10764
10765template <class t_TYPE>
10766inline
10767Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t,
10768 AllocType,
10770{
10771 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10772}
10773
10774template <class t_TYPE>
10775inline
10776Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t,
10777 AllocType,
10778 const Optional_Base&)
10779{
10780 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10781}
10782
10783template <class t_TYPE>
10784inline
10785Optional_Base<t_TYPE, false>::Optional_Base(
10786 bsl::allocator_arg_t,
10787 AllocType,
10788 BloombergLP::bslmf::MovableRef<Optional_Base>)
10789{
10790 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10791}
10792
10793template <class t_TYPE>
10794template <class t_ANY_TYPE>
10795inline
10796Optional_Base<t_TYPE, false>::Optional_Base(
10797 bsl::allocator_arg_t,
10798 AllocType,
10799 BloombergLP::bslstl::Optional_ConstructFromForwardRef,
10801{
10802 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10803}
10804
10805template <class t_TYPE>
10806template <class t_ANY_TYPE>
10807inline
10808Optional_Base<t_TYPE, false>::Optional_Base(
10809 bsl::allocator_arg_t,
10810 AllocType,
10811 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
10812 const Optional_Base<t_ANY_TYPE>&)
10813{
10814 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10815}
10816
10817template <class t_TYPE>
10818template <class t_ANY_TYPE>
10819inline
10820Optional_Base<t_TYPE, false>::Optional_Base(
10821 bsl::allocator_arg_t,
10822 AllocType,
10823 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
10824 BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>))
10825{
10826 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10827}
10828
10829#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
10830// {{{ BEGIN GENERATED CODE
10831// Command line: sim_cpp11_features.pl bslstl_optional.h
10832#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
10833#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
10834#endif
10835#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q
10836#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q BSLSTL_OPTIONAL_VARIADIC_LIMIT
10837#endif
10838#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0
10839template <class t_TYPE>
10840inline
10841Optional_Base<t_TYPE, false>::Optional_Base(
10842 bsl::allocator_arg_t,
10843 AllocType,
10845{
10846 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10847}
10848#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0
10849
10850#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1
10851template <class t_TYPE>
10852template <class t_ARGS_01>
10853inline
10854Optional_Base<t_TYPE, false>::Optional_Base(
10855 bsl::allocator_arg_t,
10856 AllocType,
10859{
10860 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10861}
10862#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1
10863
10864#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2
10865template <class t_TYPE>
10866template <class t_ARGS_01,
10867 class t_ARGS_02>
10868inline
10869Optional_Base<t_TYPE, false>::Optional_Base(
10870 bsl::allocator_arg_t,
10871 AllocType,
10875{
10876 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10877}
10878#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2
10879
10880#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3
10881template <class t_TYPE>
10882template <class t_ARGS_01,
10883 class t_ARGS_02,
10884 class t_ARGS_03>
10885inline
10886Optional_Base<t_TYPE, false>::Optional_Base(
10887 bsl::allocator_arg_t,
10888 AllocType,
10893{
10894 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10895}
10896#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3
10897
10898#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4
10899template <class t_TYPE>
10900template <class t_ARGS_01,
10901 class t_ARGS_02,
10902 class t_ARGS_03,
10903 class t_ARGS_04>
10904inline
10905Optional_Base<t_TYPE, false>::Optional_Base(
10906 bsl::allocator_arg_t,
10907 AllocType,
10913{
10914 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10915}
10916#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4
10917
10918#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5
10919template <class t_TYPE>
10920template <class t_ARGS_01,
10921 class t_ARGS_02,
10922 class t_ARGS_03,
10923 class t_ARGS_04,
10924 class t_ARGS_05>
10925inline
10926Optional_Base<t_TYPE, false>::Optional_Base(
10927 bsl::allocator_arg_t,
10928 AllocType,
10935{
10936 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10937}
10938#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5
10939
10940#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6
10941template <class t_TYPE>
10942template <class t_ARGS_01,
10943 class t_ARGS_02,
10944 class t_ARGS_03,
10945 class t_ARGS_04,
10946 class t_ARGS_05,
10947 class t_ARGS_06>
10948inline
10949Optional_Base<t_TYPE, false>::Optional_Base(
10950 bsl::allocator_arg_t,
10951 AllocType,
10959{
10960 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10961}
10962#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6
10963
10964#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7
10965template <class t_TYPE>
10966template <class t_ARGS_01,
10967 class t_ARGS_02,
10968 class t_ARGS_03,
10969 class t_ARGS_04,
10970 class t_ARGS_05,
10971 class t_ARGS_06,
10972 class t_ARGS_07>
10973inline
10974Optional_Base<t_TYPE, false>::Optional_Base(
10975 bsl::allocator_arg_t,
10976 AllocType,
10985{
10986 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
10987}
10988#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7
10989
10990#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8
10991template <class t_TYPE>
10992template <class t_ARGS_01,
10993 class t_ARGS_02,
10994 class t_ARGS_03,
10995 class t_ARGS_04,
10996 class t_ARGS_05,
10997 class t_ARGS_06,
10998 class t_ARGS_07,
10999 class t_ARGS_08>
11000inline
11001Optional_Base<t_TYPE, false>::Optional_Base(
11002 bsl::allocator_arg_t,
11003 AllocType,
11013{
11014 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11015}
11016#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8
11017
11018#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9
11019template <class t_TYPE>
11020template <class t_ARGS_01,
11021 class t_ARGS_02,
11022 class t_ARGS_03,
11023 class t_ARGS_04,
11024 class t_ARGS_05,
11025 class t_ARGS_06,
11026 class t_ARGS_07,
11027 class t_ARGS_08,
11028 class t_ARGS_09>
11029inline
11030Optional_Base<t_TYPE, false>::Optional_Base(
11031 bsl::allocator_arg_t,
11032 AllocType,
11043{
11044 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11045}
11046#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9
11047
11048#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10
11049template <class t_TYPE>
11050template <class t_ARGS_01,
11051 class t_ARGS_02,
11052 class t_ARGS_03,
11053 class t_ARGS_04,
11054 class t_ARGS_05,
11055 class t_ARGS_06,
11056 class t_ARGS_07,
11057 class t_ARGS_08,
11058 class t_ARGS_09,
11059 class t_ARGS_10>
11060inline
11061Optional_Base<t_TYPE, false>::Optional_Base(
11062 bsl::allocator_arg_t,
11063 AllocType,
11075{
11076 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11077}
11078#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10
11079
11080
11081# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
11082#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0
11083template <class t_TYPE>
11084template <class t_INIT_LIST_TYPE>
11085inline
11086Optional_Base<t_TYPE, false>::Optional_Base(
11087 bsl::allocator_arg_t,
11088 AllocType,
11090 std::initializer_list<t_INIT_LIST_TYPE>)
11091{
11092 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11093}
11094#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0
11095
11096#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1
11097template <class t_TYPE>
11098template <class t_INIT_LIST_TYPE, class t_ARGS_01>
11099inline
11100Optional_Base<t_TYPE, false>::Optional_Base(
11101 bsl::allocator_arg_t,
11102 AllocType,
11104 std::initializer_list<t_INIT_LIST_TYPE>,
11106{
11107 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11108}
11109#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1
11110
11111#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2
11112template <class t_TYPE>
11113template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11114 class t_ARGS_02>
11115inline
11116Optional_Base<t_TYPE, false>::Optional_Base(
11117 bsl::allocator_arg_t,
11118 AllocType,
11120 std::initializer_list<t_INIT_LIST_TYPE>,
11123{
11124 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11125}
11126#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2
11127
11128#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3
11129template <class t_TYPE>
11130template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11131 class t_ARGS_02,
11132 class t_ARGS_03>
11133inline
11134Optional_Base<t_TYPE, false>::Optional_Base(
11135 bsl::allocator_arg_t,
11136 AllocType,
11138 std::initializer_list<t_INIT_LIST_TYPE>,
11142{
11143 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11144}
11145#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3
11146
11147#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4
11148template <class t_TYPE>
11149template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11150 class t_ARGS_02,
11151 class t_ARGS_03,
11152 class t_ARGS_04>
11153inline
11154Optional_Base<t_TYPE, false>::Optional_Base(
11155 bsl::allocator_arg_t,
11156 AllocType,
11158 std::initializer_list<t_INIT_LIST_TYPE>,
11163{
11164 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11165}
11166#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4
11167
11168#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5
11169template <class t_TYPE>
11170template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11171 class t_ARGS_02,
11172 class t_ARGS_03,
11173 class t_ARGS_04,
11174 class t_ARGS_05>
11175inline
11176Optional_Base<t_TYPE, false>::Optional_Base(
11177 bsl::allocator_arg_t,
11178 AllocType,
11180 std::initializer_list<t_INIT_LIST_TYPE>,
11186{
11187 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11188}
11189#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5
11190
11191#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6
11192template <class t_TYPE>
11193template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11194 class t_ARGS_02,
11195 class t_ARGS_03,
11196 class t_ARGS_04,
11197 class t_ARGS_05,
11198 class t_ARGS_06>
11199inline
11200Optional_Base<t_TYPE, false>::Optional_Base(
11201 bsl::allocator_arg_t,
11202 AllocType,
11204 std::initializer_list<t_INIT_LIST_TYPE>,
11211{
11212 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11213}
11214#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6
11215
11216#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7
11217template <class t_TYPE>
11218template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11219 class t_ARGS_02,
11220 class t_ARGS_03,
11221 class t_ARGS_04,
11222 class t_ARGS_05,
11223 class t_ARGS_06,
11224 class t_ARGS_07>
11225inline
11226Optional_Base<t_TYPE, false>::Optional_Base(
11227 bsl::allocator_arg_t,
11228 AllocType,
11230 std::initializer_list<t_INIT_LIST_TYPE>,
11238{
11239 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11240}
11241#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7
11242
11243#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8
11244template <class t_TYPE>
11245template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11246 class t_ARGS_02,
11247 class t_ARGS_03,
11248 class t_ARGS_04,
11249 class t_ARGS_05,
11250 class t_ARGS_06,
11251 class t_ARGS_07,
11252 class t_ARGS_08>
11253inline
11254Optional_Base<t_TYPE, false>::Optional_Base(
11255 bsl::allocator_arg_t,
11256 AllocType,
11258 std::initializer_list<t_INIT_LIST_TYPE>,
11267{
11268 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11269}
11270#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8
11271
11272#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9
11273template <class t_TYPE>
11274template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11275 class t_ARGS_02,
11276 class t_ARGS_03,
11277 class t_ARGS_04,
11278 class t_ARGS_05,
11279 class t_ARGS_06,
11280 class t_ARGS_07,
11281 class t_ARGS_08,
11282 class t_ARGS_09>
11283inline
11284Optional_Base<t_TYPE, false>::Optional_Base(
11285 bsl::allocator_arg_t,
11286 AllocType,
11288 std::initializer_list<t_INIT_LIST_TYPE>,
11298{
11299 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11300}
11301#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9
11302
11303#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10
11304template <class t_TYPE>
11305template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11306 class t_ARGS_02,
11307 class t_ARGS_03,
11308 class t_ARGS_04,
11309 class t_ARGS_05,
11310 class t_ARGS_06,
11311 class t_ARGS_07,
11312 class t_ARGS_08,
11313 class t_ARGS_09,
11314 class t_ARGS_10>
11315inline
11316Optional_Base<t_TYPE, false>::Optional_Base(
11317 bsl::allocator_arg_t,
11318 AllocType,
11320 std::initializer_list<t_INIT_LIST_TYPE>,
11331{
11332 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11333}
11334#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10
11335
11336# endif
11337#else
11338// The generated code below is a workaround for the absence of perfect
11339// forwarding in some compilers.
11340template <class t_TYPE>
11341template <class... t_ARGS>
11342inline
11343Optional_Base<t_TYPE, false>::Optional_Base(
11344 bsl::allocator_arg_t,
11345 AllocType,
11348{
11349 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11350}
11351
11352# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
11353template <class t_TYPE>
11354template <class t_INIT_LIST_TYPE, class... t_ARGS>
11355inline
11356Optional_Base<t_TYPE, false>::Optional_Base(
11357 bsl::allocator_arg_t,
11358 AllocType,
11360 std::initializer_list<t_INIT_LIST_TYPE>,
11362{
11363 BSLS_ASSERT_INVOKE_NORETURN("Unreachable");
11364}
11365# endif
11366// }}} END GENERATED CODE
11367#endif
11368
11369// PROTECTED MANIPULATORS
11370template <class t_TYPE>
11371template <class t_ANY_TYPE>
11372void Optional_Base<t_TYPE, false>::assignOrEmplace(
11373 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) rhs)
11374{
11375 if (has_value()) {
11376 d_value.value() = BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, rhs);
11377 } else {
11378 emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, rhs));
11379 }
11380}
11381
11382# ifndef BDE_OMIT_INTERNAL_DEPRECATED
11383template <class t_TYPE>
11384t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw()
11385{
11386 // This method is provided for the purpose of allowing 'NullableValue' to
11387 // determine the assert level in its value() method. Do not assert here.
11388
11389 return d_value.value();
11390
11391}
11392
11393// PROTECTED ACCESORS
11394template <class t_TYPE>
11395const t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw() const
11396{
11397 // This method is provided for the purpose of allowing 'NullableValue' to
11398 // determine the assert level in its value() method. Do not assert here.
11399
11400 return d_value.value();
11401
11402}
11403# endif // BDE_OMIT_INTERNAL_DEPRECATED
11404
11405// MANIPULATORS
11406#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
11407// {{{ BEGIN GENERATED CODE
11408// Command line: sim_cpp11_features.pl bslstl_optional.h
11409#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
11410#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
11411#endif
11412#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_R
11413#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_R BSLSTL_OPTIONAL_VARIADIC_LIMIT
11414#endif
11415#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0
11416template <class t_TYPE>
11417inline
11418t_TYPE&
11419Optional_Base<t_TYPE, false>::emplace(
11420 )
11421{
11422 return d_value.emplace(NULL);
11423}
11424#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0
11425
11426#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1
11427template <class t_TYPE>
11428template <class t_ARGS_01>
11429inline
11430t_TYPE&
11431Optional_Base<t_TYPE, false>::emplace(
11432 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
11433{
11434 return d_value.emplace(NULL,
11435 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
11436}
11437#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1
11438
11439#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2
11440template <class t_TYPE>
11441template <class t_ARGS_01,
11442 class t_ARGS_02>
11443inline
11444t_TYPE&
11445Optional_Base<t_TYPE, false>::emplace(
11446 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11447 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
11448{
11449 return d_value.emplace(NULL,
11450 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11451 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
11452}
11453#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2
11454
11455#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3
11456template <class t_TYPE>
11457template <class t_ARGS_01,
11458 class t_ARGS_02,
11459 class t_ARGS_03>
11460inline
11461t_TYPE&
11462Optional_Base<t_TYPE, false>::emplace(
11463 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11464 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11465 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
11466{
11467 return d_value.emplace(NULL,
11468 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11469 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11470 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
11471}
11472#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3
11473
11474#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4
11475template <class t_TYPE>
11476template <class t_ARGS_01,
11477 class t_ARGS_02,
11478 class t_ARGS_03,
11479 class t_ARGS_04>
11480inline
11481t_TYPE&
11482Optional_Base<t_TYPE, false>::emplace(
11483 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11484 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11485 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11486 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
11487{
11488 return d_value.emplace(NULL,
11489 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11490 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11491 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11492 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
11493}
11494#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4
11495
11496#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5
11497template <class t_TYPE>
11498template <class t_ARGS_01,
11499 class t_ARGS_02,
11500 class t_ARGS_03,
11501 class t_ARGS_04,
11502 class t_ARGS_05>
11503inline
11504t_TYPE&
11505Optional_Base<t_TYPE, false>::emplace(
11506 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11507 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11508 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11509 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11510 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
11511{
11512 return d_value.emplace(NULL,
11513 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11514 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11515 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11516 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11517 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
11518}
11519#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5
11520
11521#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6
11522template <class t_TYPE>
11523template <class t_ARGS_01,
11524 class t_ARGS_02,
11525 class t_ARGS_03,
11526 class t_ARGS_04,
11527 class t_ARGS_05,
11528 class t_ARGS_06>
11529inline
11530t_TYPE&
11531Optional_Base<t_TYPE, false>::emplace(
11532 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11533 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11534 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11535 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11536 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11537 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
11538{
11539 return d_value.emplace(NULL,
11540 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11541 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11542 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11543 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11544 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11545 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
11546}
11547#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6
11548
11549#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7
11550template <class t_TYPE>
11551template <class t_ARGS_01,
11552 class t_ARGS_02,
11553 class t_ARGS_03,
11554 class t_ARGS_04,
11555 class t_ARGS_05,
11556 class t_ARGS_06,
11557 class t_ARGS_07>
11558inline
11559t_TYPE&
11560Optional_Base<t_TYPE, false>::emplace(
11561 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11562 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11563 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11564 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11565 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11566 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
11567 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
11568{
11569 return d_value.emplace(NULL,
11570 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11571 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11572 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11573 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11574 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11575 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
11576 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
11577}
11578#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7
11579
11580#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8
11581template <class t_TYPE>
11582template <class t_ARGS_01,
11583 class t_ARGS_02,
11584 class t_ARGS_03,
11585 class t_ARGS_04,
11586 class t_ARGS_05,
11587 class t_ARGS_06,
11588 class t_ARGS_07,
11589 class t_ARGS_08>
11590inline
11591t_TYPE&
11592Optional_Base<t_TYPE, false>::emplace(
11593 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11594 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11595 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11596 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11597 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11598 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
11599 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
11600 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
11601{
11602 return d_value.emplace(NULL,
11603 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11604 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11605 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11606 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11607 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11608 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
11609 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
11610 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
11611}
11612#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8
11613
11614#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9
11615template <class t_TYPE>
11616template <class t_ARGS_01,
11617 class t_ARGS_02,
11618 class t_ARGS_03,
11619 class t_ARGS_04,
11620 class t_ARGS_05,
11621 class t_ARGS_06,
11622 class t_ARGS_07,
11623 class t_ARGS_08,
11624 class t_ARGS_09>
11625inline
11626t_TYPE&
11627Optional_Base<t_TYPE, false>::emplace(
11628 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11629 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11630 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11631 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11632 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11633 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
11634 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
11635 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
11636 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
11637{
11638 return d_value.emplace(NULL,
11639 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11640 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11641 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11642 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11643 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11644 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
11645 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
11646 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
11647 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
11648}
11649#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9
11650
11651#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10
11652template <class t_TYPE>
11653template <class t_ARGS_01,
11654 class t_ARGS_02,
11655 class t_ARGS_03,
11656 class t_ARGS_04,
11657 class t_ARGS_05,
11658 class t_ARGS_06,
11659 class t_ARGS_07,
11660 class t_ARGS_08,
11661 class t_ARGS_09,
11662 class t_ARGS_10>
11663inline
11664t_TYPE&
11665Optional_Base<t_TYPE, false>::emplace(
11666 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11667 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11668 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11669 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11670 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11671 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
11672 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
11673 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
11674 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
11675 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
11676{
11677 return d_value.emplace(NULL,
11678 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11679 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11680 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11681 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11682 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11683 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
11684 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
11685 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
11686 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
11687 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
11688}
11689#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10
11690
11691
11692# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
11693#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0
11694template <class t_TYPE>
11695template <class t_INIT_LIST_TYPE>
11696t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11697 std::initializer_list<t_INIT_LIST_TYPE> il)
11698{
11699 return d_value.emplace(
11700 NULL, il);
11701}
11702#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0
11703
11704#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1
11705template <class t_TYPE>
11706template <class t_INIT_LIST_TYPE, class t_ARGS_01>
11707t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11708 std::initializer_list<t_INIT_LIST_TYPE> il,
11709 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
11710{
11711 return d_value.emplace(
11712 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
11713}
11714#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1
11715
11716#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2
11717template <class t_TYPE>
11718template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11719 class t_ARGS_02>
11720t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11721 std::initializer_list<t_INIT_LIST_TYPE> il,
11722 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11723 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
11724{
11725 return d_value.emplace(
11726 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11727 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
11728}
11729#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2
11730
11731#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3
11732template <class t_TYPE>
11733template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11734 class t_ARGS_02,
11735 class t_ARGS_03>
11736t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11737 std::initializer_list<t_INIT_LIST_TYPE> il,
11738 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11739 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11740 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
11741{
11742 return d_value.emplace(
11743 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11744 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11745 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
11746}
11747#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3
11748
11749#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4
11750template <class t_TYPE>
11751template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11752 class t_ARGS_02,
11753 class t_ARGS_03,
11754 class t_ARGS_04>
11755t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11756 std::initializer_list<t_INIT_LIST_TYPE> il,
11757 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11758 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11759 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11760 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
11761{
11762 return d_value.emplace(
11763 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11764 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11765 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11766 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
11767}
11768#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4
11769
11770#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5
11771template <class t_TYPE>
11772template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11773 class t_ARGS_02,
11774 class t_ARGS_03,
11775 class t_ARGS_04,
11776 class t_ARGS_05>
11777t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11778 std::initializer_list<t_INIT_LIST_TYPE> il,
11779 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11780 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11781 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11782 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11783 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
11784{
11785 return d_value.emplace(
11786 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11787 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11788 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11789 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11790 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
11791}
11792#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5
11793
11794#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6
11795template <class t_TYPE>
11796template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11797 class t_ARGS_02,
11798 class t_ARGS_03,
11799 class t_ARGS_04,
11800 class t_ARGS_05,
11801 class t_ARGS_06>
11802t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11803 std::initializer_list<t_INIT_LIST_TYPE> il,
11804 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11805 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11806 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11807 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11808 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11809 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
11810{
11811 return d_value.emplace(
11812 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11813 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11814 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11815 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11816 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11817 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
11818}
11819#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6
11820
11821#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7
11822template <class t_TYPE>
11823template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11824 class t_ARGS_02,
11825 class t_ARGS_03,
11826 class t_ARGS_04,
11827 class t_ARGS_05,
11828 class t_ARGS_06,
11829 class t_ARGS_07>
11830t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11831 std::initializer_list<t_INIT_LIST_TYPE> il,
11832 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11833 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11834 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11835 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11836 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11837 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
11838 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
11839{
11840 return d_value.emplace(
11841 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11842 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11843 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11844 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11845 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11846 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
11847 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
11848}
11849#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7
11850
11851#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8
11852template <class t_TYPE>
11853template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11854 class t_ARGS_02,
11855 class t_ARGS_03,
11856 class t_ARGS_04,
11857 class t_ARGS_05,
11858 class t_ARGS_06,
11859 class t_ARGS_07,
11860 class t_ARGS_08>
11861t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11862 std::initializer_list<t_INIT_LIST_TYPE> il,
11863 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11864 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11865 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11866 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11867 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11868 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
11869 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
11870 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
11871{
11872 return d_value.emplace(
11873 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11874 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11875 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11876 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11877 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11878 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
11879 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
11880 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
11881}
11882#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8
11883
11884#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9
11885template <class t_TYPE>
11886template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11887 class t_ARGS_02,
11888 class t_ARGS_03,
11889 class t_ARGS_04,
11890 class t_ARGS_05,
11891 class t_ARGS_06,
11892 class t_ARGS_07,
11893 class t_ARGS_08,
11894 class t_ARGS_09>
11895t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11896 std::initializer_list<t_INIT_LIST_TYPE> il,
11897 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11898 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11899 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11900 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11901 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11902 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
11903 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
11904 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
11905 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
11906{
11907 return d_value.emplace(
11908 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11909 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11910 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11911 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11912 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11913 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
11914 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
11915 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
11916 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
11917}
11918#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9
11919
11920#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10
11921template <class t_TYPE>
11922template <class t_INIT_LIST_TYPE, class t_ARGS_01,
11923 class t_ARGS_02,
11924 class t_ARGS_03,
11925 class t_ARGS_04,
11926 class t_ARGS_05,
11927 class t_ARGS_06,
11928 class t_ARGS_07,
11929 class t_ARGS_08,
11930 class t_ARGS_09,
11931 class t_ARGS_10>
11932t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11933 std::initializer_list<t_INIT_LIST_TYPE> il,
11934 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
11935 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
11936 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
11937 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
11938 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
11939 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
11940 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
11941 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
11942 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
11943 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
11944{
11945 return d_value.emplace(
11946 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
11947 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
11948 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
11949 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
11950 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
11951 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
11952 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
11953 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
11954 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
11955 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
11956}
11957#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10
11958
11959# endif
11960#else
11961// The generated code below is a workaround for the absence of perfect
11962// forwarding in some compilers.
11963template <class t_TYPE>
11964template <class... t_ARGS>
11965inline
11966t_TYPE&
11967Optional_Base<t_TYPE, false>::emplace(
11968 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
11969{
11970 return d_value.emplace(NULL,
11971 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
11972}
11973
11974# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
11975template <class t_TYPE>
11976template <class t_INIT_LIST_TYPE, class... t_ARGS>
11977t_TYPE& Optional_Base<t_TYPE, false>::emplace(
11978 std::initializer_list<t_INIT_LIST_TYPE> il,
11979 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
11980{
11981 return d_value.emplace(
11982 NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
11983}
11984# endif
11985// }}} END GENERATED CODE
11986#endif
11987
11988template <class t_TYPE>
11989inline
11990void Optional_Base<t_TYPE, false>::reset() BSLS_KEYWORD_NOEXCEPT
11991{
11992 d_value.reset();
11993}
11994
11995template <class t_TYPE>
11996void Optional_Base<t_TYPE, false>::swap(Optional_Base& other)
11999 bsl::is_nothrow_swappable<t_TYPE>::value)
12000{
12001 if (this->has_value() && other.has_value()) {
12002 BloombergLP::bslalg::SwapUtil::swap(
12003 BSLS_UTIL_ADDRESSOF(d_value.value()),
12004 BSLS_UTIL_ADDRESSOF(*other));
12005 }
12006 else if (this->has_value()) {
12007 other.emplace(MoveUtil::move(d_value.value()));
12008 this->reset();
12009 }
12010 else if (other.has_value()) {
12011 this->emplace(MoveUtil::move(*other));
12012 other.reset();
12013 }
12014}
12015
12016# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12017template <class t_TYPE>
12018inline
12019t_TYPE& Optional_Base<t_TYPE, false>::value() &
12020{
12021 if (!has_value())
12022 BSLS_THROW(bsl::bad_optional_access());
12023
12024 return d_value.value();
12025}
12026template <class t_TYPE>
12027inline
12028t_TYPE&&
12029Optional_Base<t_TYPE, false>::value() &&
12030{
12031 if (!has_value())
12032 BSLS_THROW(bsl::bad_optional_access());
12033
12034 return std::move(d_value.value());
12035}
12036
12037# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12038template <class t_TYPE>
12039inline
12040t_TYPE& Optional_Base<t_TYPE, false>::value()
12041{
12042 if (!has_value())
12043 BSLS_THROW(bsl::bad_optional_access());
12044
12045 return d_value.value();
12046}
12047
12048# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
12049
12050# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12051template <class t_TYPE>
12052template <class t_ANY_TYPE>
12053inline
12054t_TYPE
12055Optional_Base<t_TYPE, false>::value_or(t_ANY_TYPE&& value) &&
12056{
12057 if (has_value()) {
12058 return t_TYPE(std::move(d_value.value())); // RETURN
12059 }
12060 else {
12061 return t_TYPE(std::forward<t_ANY_TYPE>(value)); // RETURN
12062 }
12063}
12064# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12065
12066template <class t_TYPE>
12067inline
12068Optional_Base<t_TYPE, false>&
12069Optional_Base<t_TYPE, false>::operator=(const Optional_Base& rhs)
12070{
12071 if (rhs.has_value()) {
12072 if (this->has_value()) {
12073 d_value.value() = *rhs;
12074 }
12075 else {
12076 emplace(*rhs);
12077 }
12078 }
12079 else {
12080 reset();
12081 }
12082 return *this;
12083}
12084
12085template <class t_TYPE>
12086inline
12087Optional_Base<t_TYPE, false>&
12088Optional_Base<t_TYPE, false>::operator=(
12089 BloombergLP::bslmf::MovableRef<Optional_Base> rhs)
12090{
12091 Optional_Base& lvalue = rhs;
12092 if (lvalue.has_value()) {
12093 if (this->has_value()) {
12094 d_value.value() = MoveUtil::move(*lvalue);
12095 }
12096 else {
12097 emplace(MoveUtil::move(*lvalue));
12098 }
12099 }
12100 else {
12101 reset();
12102 }
12103 return *this;
12104}
12105
12106# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12107template <class t_TYPE>
12108inline
12109t_TYPE& Optional_Base<t_TYPE, false>::operator*() &
12110{
12111 BSLS_ASSERT(has_value());
12112
12113 return d_value.value();
12114}
12115
12116template <class t_TYPE>
12117inline
12118t_TYPE&& Optional_Base<t_TYPE, false>::operator*() &&
12119{
12120 BSLS_ASSERT(has_value());
12121
12122 return std::move(d_value.value());
12123}
12124# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12125template <class t_TYPE>
12126inline
12127t_TYPE& Optional_Base<t_TYPE, false>::operator*()
12128{
12129 BSLS_ASSERT(has_value());
12130
12131 return d_value.value();
12132}
12133# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12134
12135template <class t_TYPE>
12136inline
12137t_TYPE *Optional_Base<t_TYPE, false>::operator->()
12138{
12139 BSLS_ASSERT(has_value());
12140
12141 return BSLS_UTIL_ADDRESSOF(d_value.value());
12142}
12143
12144// ACCESSORS
12145
12146template <class t_TYPE>
12147inline
12148bool Optional_Base<t_TYPE, false>::has_value() const BSLS_KEYWORD_NOEXCEPT
12149{
12150 return d_value.hasValue();
12151}
12152
12153# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12154template <class t_TYPE>
12155inline
12156const t_TYPE&
12157Optional_Base<t_TYPE, false>::value() const&
12158{
12159 if (!has_value())
12160 BSLS_THROW(bsl::bad_optional_access());
12161
12162 return d_value.value();
12163}
12164
12165template <class t_TYPE>
12166inline
12167const t_TYPE&&
12168Optional_Base<t_TYPE, false>::value() const&&
12169{
12170 if (!has_value())
12171 BSLS_THROW(bsl::bad_optional_access());
12172
12173 return std::move(d_value.value());
12174}
12175
12176# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12177template <class t_TYPE>
12178inline
12179const t_TYPE&
12180Optional_Base<t_TYPE, false>::value() const
12181{
12182 if (!has_value())
12183 BSLS_THROW(bsl::bad_optional_access());
12184
12185 return d_value.value();
12186}
12187
12188# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
12189
12190# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12191
12192template <class t_TYPE>
12193template <class t_ANY_TYPE>
12194inline
12195t_TYPE
12196Optional_Base<t_TYPE, false>::value_or(
12197 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
12198const &
12199{
12200 if (has_value()) {
12201 return t_TYPE(d_value.value()); // RETURN
12202 }
12203 else {
12204 return t_TYPE(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE,
12205 value)); // RETURN
12206 }
12207}
12208
12209# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12210template <class t_TYPE>
12211template <class t_ANY_TYPE>
12212inline
12213t_TYPE
12214Optional_Base<t_TYPE, false>::value_or(
12215 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
12216const
12217{
12218 if (has_value()) {
12219 return t_TYPE(d_value.value()); // RETURN
12220 }
12221 else {
12222 return t_TYPE(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE,
12223 value)); // RETURN
12224 }
12225}
12226
12227# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
12228
12229template <class t_TYPE>
12230inline
12231const t_TYPE *Optional_Base<t_TYPE, false>::operator->() const
12232{
12233 BSLS_ASSERT(has_value());
12234
12235 return BSLS_UTIL_ADDRESSOF(d_value.value());
12236}
12237
12238# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12239template <class t_TYPE>
12240inline
12241const t_TYPE& Optional_Base<t_TYPE, false>::operator*() const&
12242{
12243 BSLS_ASSERT(has_value());
12244
12245 return d_value.value();
12246}
12247
12248template <class t_TYPE>
12249inline
12250const t_TYPE&& Optional_Base<t_TYPE, false>::operator*() const&&
12251{
12252 BSLS_ASSERT(has_value());
12253
12254 return std::move(d_value.value());
12255}
12256
12257# else // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
12258template <class t_TYPE>
12259inline
12260const t_TYPE& Optional_Base<t_TYPE, false>::operator*() const
12261{
12262 BSLS_ASSERT(has_value());
12263
12264 return d_value.value();
12265}
12266# endif // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
12267
12268#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
12269template <class t_TYPE>
12270Optional_Base<t_TYPE, false>::operator bool() const BSLS_KEYWORD_NOEXCEPT
12271{
12272 return has_value();
12273}
12274#endif // BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
12275# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
12276
12277} // close package namespace
12278
12279
12280// ============================================================================
12281// Section: 'optional' Method Definitions
12282// ============================================================================
12283
12284 // ==============
12285 // class optional
12286 // ==============
12287
12288namespace bsl {
12289
12290// CREATORS
12291template <class t_TYPE>
12293: BaseType()
12294{
12295}
12296
12297template <class t_TYPE>
12299: BaseType()
12300{
12301}
12302
12303#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
12304template <class t_TYPE>
12305template <class t_DERIVED>
12307 BloombergLP::bslmf::MovableRef<t_DERIVED> original,
12311: BaseType(MoveUtil::move(static_cast<BaseType&>(original)))
12312{
12313}
12314#endif
12315
12316template <class t_TYPE>
12317template <class t_ANY_TYPE>
12319 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
12322: BaseType(BloombergLP::bslstl::Optional_ConstructFromForwardRef(),
12323 BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value))
12324{
12325}
12326
12327template <class t_TYPE>
12328template <class t_ANY_TYPE>
12329optional<t_TYPE>::optional(
12330 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
12333: BaseType(BloombergLP::bslstl::Optional_ConstructFromForwardRef(),
12334 BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value))
12335{
12336}
12337
12338template <class t_TYPE>
12339template <class t_ANY_TYPE>
12340optional<t_TYPE>::optional(
12341 const optional<t_ANY_TYPE>& original,
12343 const t_ANY_TYPE&),
12345 const t_ANY_TYPE&))
12346: BaseType(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional(),
12347 original)
12348{
12349}
12350
12351template <class t_TYPE>
12352template <class t_ANY_TYPE>
12353optional<t_TYPE>::optional(
12354 const optional<t_ANY_TYPE>& original,
12356 const t_ANY_TYPE&),
12357 BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE&))
12358: BaseType(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional(),
12359 original)
12360{
12361}
12362
12363template <class t_TYPE>
12364template <class t_ANY_TYPE>
12365optional<t_TYPE>::optional(
12366 BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
12369: BaseType(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional(),
12370 MoveUtil::move(
12371 static_cast<BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>&>(
12372 original)))
12373{
12374}
12375
12376template <class t_TYPE>
12377template <class t_ANY_TYPE>
12378optional<t_TYPE>::optional(
12379 BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
12382: BaseType(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional(),
12383 MoveUtil::move(
12384 static_cast<BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>&>(
12385 original)))
12386{
12387}
12388
12389#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
12390template <class t_TYPE>
12391template <class t_ANY_TYPE>
12392optional<t_TYPE>::optional(
12393 const std::optional<t_ANY_TYPE>& original,
12395 const t_ANY_TYPE&),
12397: BaseType(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional(),
12398 original)
12399{
12400}
12401
12402template <class t_TYPE>
12403template <class t_ANY_TYPE>
12404optional<t_TYPE>::optional(
12405 const std::optional<t_ANY_TYPE>& original,
12407 const t_ANY_TYPE&),
12409: BaseType(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional(),
12410 original)
12411{
12412}
12413
12414template <class t_TYPE>
12415template <class t_ANY_TYPE>
12416optional<t_TYPE>::optional(
12417 std::optional<t_ANY_TYPE>&& original,
12420: BaseType(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional(),
12421 std::move(original))
12422{
12423}
12424
12425template <class t_TYPE>
12426template <class t_ANY_TYPE>
12427optional<t_TYPE>::optional(
12428 std::optional<t_ANY_TYPE>&& original,
12431: BaseType(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional(),
12432 std::move(original))
12433{
12434}
12435# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
12436
12437#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
12438// {{{ BEGIN GENERATED CODE
12439// Command line: sim_cpp11_features.pl bslstl_optional.h
12440#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
12441#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
12442#endif
12443#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_S
12444#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_S BSLSTL_OPTIONAL_VARIADIC_LIMIT
12445#endif
12446#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0
12447template <class t_TYPE>
12448optional<t_TYPE>::optional(bsl::in_place_t)
12449: BaseType(bsl::in_place)
12450{
12451}
12452#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0
12453
12454#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1
12455template <class t_TYPE>
12456template <class t_ARGS_01>
12457optional<t_TYPE>::optional(bsl::in_place_t,
12458 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
12459: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01))
12460{
12461}
12462#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1
12463
12464#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2
12465template <class t_TYPE>
12466template <class t_ARGS_01,
12467 class t_ARGS_02>
12468optional<t_TYPE>::optional(bsl::in_place_t,
12469 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12470 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
12471: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12472 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02))
12473{
12474}
12475#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2
12476
12477#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3
12478template <class t_TYPE>
12479template <class t_ARGS_01,
12480 class t_ARGS_02,
12481 class t_ARGS_03>
12482optional<t_TYPE>::optional(bsl::in_place_t,
12483 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12484 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12485 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
12486: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12487 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12488 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03))
12489{
12490}
12491#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3
12492
12493#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4
12494template <class t_TYPE>
12495template <class t_ARGS_01,
12496 class t_ARGS_02,
12497 class t_ARGS_03,
12498 class t_ARGS_04>
12499optional<t_TYPE>::optional(bsl::in_place_t,
12500 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12501 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12502 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12503 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
12504: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12505 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12506 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12507 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04))
12508{
12509}
12510#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4
12511
12512#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5
12513template <class t_TYPE>
12514template <class t_ARGS_01,
12515 class t_ARGS_02,
12516 class t_ARGS_03,
12517 class t_ARGS_04,
12518 class t_ARGS_05>
12519optional<t_TYPE>::optional(bsl::in_place_t,
12520 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12521 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12522 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12523 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12524 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
12525: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12526 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12527 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12528 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12529 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05))
12530{
12531}
12532#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5
12533
12534#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6
12535template <class t_TYPE>
12536template <class t_ARGS_01,
12537 class t_ARGS_02,
12538 class t_ARGS_03,
12539 class t_ARGS_04,
12540 class t_ARGS_05,
12541 class t_ARGS_06>
12542optional<t_TYPE>::optional(bsl::in_place_t,
12543 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12544 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12545 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12546 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12547 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12548 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
12549: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12550 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12551 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12552 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12553 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12554 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06))
12555{
12556}
12557#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6
12558
12559#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7
12560template <class t_TYPE>
12561template <class t_ARGS_01,
12562 class t_ARGS_02,
12563 class t_ARGS_03,
12564 class t_ARGS_04,
12565 class t_ARGS_05,
12566 class t_ARGS_06,
12567 class t_ARGS_07>
12568optional<t_TYPE>::optional(bsl::in_place_t,
12569 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12570 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12571 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12572 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12573 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12574 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
12575 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
12576: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12577 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12578 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12579 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12580 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12581 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
12582 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07))
12583{
12584}
12585#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7
12586
12587#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8
12588template <class t_TYPE>
12589template <class t_ARGS_01,
12590 class t_ARGS_02,
12591 class t_ARGS_03,
12592 class t_ARGS_04,
12593 class t_ARGS_05,
12594 class t_ARGS_06,
12595 class t_ARGS_07,
12596 class t_ARGS_08>
12597optional<t_TYPE>::optional(bsl::in_place_t,
12598 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12599 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12600 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12601 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12602 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12603 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
12604 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
12605 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
12606: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12607 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12608 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12609 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12610 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12611 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
12612 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
12613 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08))
12614{
12615}
12616#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8
12617
12618#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9
12619template <class t_TYPE>
12620template <class t_ARGS_01,
12621 class t_ARGS_02,
12622 class t_ARGS_03,
12623 class t_ARGS_04,
12624 class t_ARGS_05,
12625 class t_ARGS_06,
12626 class t_ARGS_07,
12627 class t_ARGS_08,
12628 class t_ARGS_09>
12629optional<t_TYPE>::optional(bsl::in_place_t,
12630 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12631 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12632 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12633 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12634 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12635 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
12636 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
12637 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
12638 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
12639: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12640 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12641 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12642 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12643 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12644 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
12645 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
12646 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
12647 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09))
12648{
12649}
12650#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9
12651
12652#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10
12653template <class t_TYPE>
12654template <class t_ARGS_01,
12655 class t_ARGS_02,
12656 class t_ARGS_03,
12657 class t_ARGS_04,
12658 class t_ARGS_05,
12659 class t_ARGS_06,
12660 class t_ARGS_07,
12661 class t_ARGS_08,
12662 class t_ARGS_09,
12663 class t_ARGS_10>
12664optional<t_TYPE>::optional(bsl::in_place_t,
12665 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12666 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12667 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12668 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12669 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12670 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
12671 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
12672 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
12673 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
12674 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
12675: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12676 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12677 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12678 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12679 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12680 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
12681 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
12682 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
12683 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
12684 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10))
12685{
12686}
12687#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10
12688
12689#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
12690#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0
12691template <class t_TYPE>
12692template <class t_INIT_LIST_TYPE>
12693optional<t_TYPE>::optional(bsl::in_place_t,
12694 std::initializer_list<t_INIT_LIST_TYPE> il)
12695: BaseType(bsl::in_place, il)
12696{
12697}
12698#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0
12699
12700#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1
12701template <class t_TYPE>
12702template <class t_INIT_LIST_TYPE, class t_ARGS_01>
12703optional<t_TYPE>::optional(bsl::in_place_t,
12704 std::initializer_list<t_INIT_LIST_TYPE> il,
12705 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
12706: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01))
12707{
12708}
12709#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1
12710
12711#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2
12712template <class t_TYPE>
12713template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12714 class t_ARGS_02>
12715optional<t_TYPE>::optional(bsl::in_place_t,
12716 std::initializer_list<t_INIT_LIST_TYPE> il,
12717 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12718 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
12719: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12720 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02))
12721{
12722}
12723#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2
12724
12725#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3
12726template <class t_TYPE>
12727template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12728 class t_ARGS_02,
12729 class t_ARGS_03>
12730optional<t_TYPE>::optional(bsl::in_place_t,
12731 std::initializer_list<t_INIT_LIST_TYPE> il,
12732 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12733 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12734 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
12735: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12736 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12737 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03))
12738{
12739}
12740#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3
12741
12742#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4
12743template <class t_TYPE>
12744template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12745 class t_ARGS_02,
12746 class t_ARGS_03,
12747 class t_ARGS_04>
12748optional<t_TYPE>::optional(bsl::in_place_t,
12749 std::initializer_list<t_INIT_LIST_TYPE> il,
12750 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12751 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12752 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12753 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
12754: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12755 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12756 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12757 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04))
12758{
12759}
12760#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4
12761
12762#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5
12763template <class t_TYPE>
12764template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12765 class t_ARGS_02,
12766 class t_ARGS_03,
12767 class t_ARGS_04,
12768 class t_ARGS_05>
12769optional<t_TYPE>::optional(bsl::in_place_t,
12770 std::initializer_list<t_INIT_LIST_TYPE> il,
12771 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12772 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12773 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12774 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12775 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
12776: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12777 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12778 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12779 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12780 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05))
12781{
12782}
12783#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5
12784
12785#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6
12786template <class t_TYPE>
12787template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12788 class t_ARGS_02,
12789 class t_ARGS_03,
12790 class t_ARGS_04,
12791 class t_ARGS_05,
12792 class t_ARGS_06>
12793optional<t_TYPE>::optional(bsl::in_place_t,
12794 std::initializer_list<t_INIT_LIST_TYPE> il,
12795 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12796 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12797 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12798 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12799 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12800 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
12801: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12802 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12803 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12804 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12805 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12806 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06))
12807{
12808}
12809#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6
12810
12811#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7
12812template <class t_TYPE>
12813template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12814 class t_ARGS_02,
12815 class t_ARGS_03,
12816 class t_ARGS_04,
12817 class t_ARGS_05,
12818 class t_ARGS_06,
12819 class t_ARGS_07>
12820optional<t_TYPE>::optional(bsl::in_place_t,
12821 std::initializer_list<t_INIT_LIST_TYPE> il,
12822 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12823 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12824 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12825 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12826 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12827 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
12828 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
12829: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12830 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12831 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12832 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12833 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12834 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
12835 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07))
12836{
12837}
12838#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7
12839
12840#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8
12841template <class t_TYPE>
12842template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12843 class t_ARGS_02,
12844 class t_ARGS_03,
12845 class t_ARGS_04,
12846 class t_ARGS_05,
12847 class t_ARGS_06,
12848 class t_ARGS_07,
12849 class t_ARGS_08>
12850optional<t_TYPE>::optional(bsl::in_place_t,
12851 std::initializer_list<t_INIT_LIST_TYPE> il,
12852 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12853 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12854 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12855 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12856 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12857 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
12858 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
12859 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
12860: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12861 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12862 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12863 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12864 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12865 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
12866 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
12867 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08))
12868{
12869}
12870#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8
12871
12872#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9
12873template <class t_TYPE>
12874template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12875 class t_ARGS_02,
12876 class t_ARGS_03,
12877 class t_ARGS_04,
12878 class t_ARGS_05,
12879 class t_ARGS_06,
12880 class t_ARGS_07,
12881 class t_ARGS_08,
12882 class t_ARGS_09>
12883optional<t_TYPE>::optional(bsl::in_place_t,
12884 std::initializer_list<t_INIT_LIST_TYPE> il,
12885 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12886 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12887 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12888 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12889 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12890 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
12891 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
12892 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
12893 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
12894: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12895 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12896 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12897 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12898 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12899 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
12900 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
12901 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
12902 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09))
12903{
12904}
12905#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9
12906
12907#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10
12908template <class t_TYPE>
12909template <class t_INIT_LIST_TYPE, class t_ARGS_01,
12910 class t_ARGS_02,
12911 class t_ARGS_03,
12912 class t_ARGS_04,
12913 class t_ARGS_05,
12914 class t_ARGS_06,
12915 class t_ARGS_07,
12916 class t_ARGS_08,
12917 class t_ARGS_09,
12918 class t_ARGS_10>
12919optional<t_TYPE>::optional(bsl::in_place_t,
12920 std::initializer_list<t_INIT_LIST_TYPE> il,
12921 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
12922 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
12923 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
12924 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
12925 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
12926 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
12927 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
12928 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
12929 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
12930 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
12931: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
12932 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
12933 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
12934 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
12935 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
12936 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
12937 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
12938 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
12939 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
12940 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10))
12941{
12942}
12943#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10
12944
12945#endif
12946#else
12947// The generated code below is a workaround for the absence of perfect
12948// forwarding in some compilers.
12949template <class t_TYPE>
12950template <class... t_ARGS>
12951optional<t_TYPE>::optional(bsl::in_place_t,
12952 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
12953: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...)
12954{
12955}
12956#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
12957template <class t_TYPE>
12958template <class t_INIT_LIST_TYPE, class... t_ARGS>
12959optional<t_TYPE>::optional(bsl::in_place_t,
12960 std::initializer_list<t_INIT_LIST_TYPE> il,
12961 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
12962: BaseType(bsl::in_place, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...)
12963{
12964}
12965#endif
12966// }}} END GENERATED CODE
12967#endif
12968
12969template <class t_TYPE>
12970optional<t_TYPE>::optional(bsl::allocator_arg_t, AllocType allocator)
12971: BaseType(bsl::allocator_arg, allocator)
12972{
12973}
12974
12975template <class t_TYPE>
12976optional<t_TYPE>::optional(bsl::allocator_arg_t,
12977 AllocType allocator,
12979: BaseType(bsl::allocator_arg, allocator)
12980{
12981}
12982
12983template <class t_TYPE>
12984optional<t_TYPE>::optional(bsl::allocator_arg_t,
12985 AllocType allocator,
12986 const optional& original)
12987: BaseType(bsl::allocator_arg, allocator, original)
12988{
12989}
12990
12991template <class t_TYPE>
12992template <class t_DERIVED>
12993optional<t_TYPE>::optional(bsl::allocator_arg_t,
12994 AllocType allocator,
12995 BSLMF_MOVABLEREF_DEDUCE(t_DERIVED) original,
12997 typename bsl::remove_reference<t_DERIVED>::type))
12998: BaseType(bsl::allocator_arg_t(),
12999 allocator,
13000 MoveUtil::move(static_cast<BaseType&>(original)))
13001{
13002 // Implementation Note: The @ref remove_reference in the signature is needed
13003 // to work around a bug in GCC 10. (It has not been determined whether
13004 // other versions are affected.)
13005}
13006
13007template <class t_TYPE>
13008template <class t_ANY_TYPE>
13009optional<t_TYPE>::optional(
13010 bsl::allocator_arg_t,
13011 AllocType allocator,
13012 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
13015: BaseType(bsl::allocator_arg_t(),
13016 allocator,
13017 BloombergLP::bslstl::Optional_ConstructFromForwardRef(),
13018 BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value))
13019{
13020}
13021
13022template <class t_TYPE>
13023template <class t_ANY_TYPE>
13024optional<t_TYPE>::optional(
13025 bsl::allocator_arg_t,
13026 AllocType allocator,
13027 BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
13030: BaseType(bsl::allocator_arg_t(),
13031 allocator,
13032 BloombergLP::bslstl::Optional_ConstructFromForwardRef(),
13033 BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value))
13034{
13035}
13036
13037template <class t_TYPE>
13038template <class t_ANY_TYPE>
13039optional<t_TYPE>::optional(
13040 bsl::allocator_arg_t,
13041 AllocType allocator,
13042 const optional<t_ANY_TYPE>& original,
13044 const t_ANY_TYPE&),
13046 const t_ANY_TYPE&))
13047: BaseType(bsl::allocator_arg_t(),
13048 allocator,
13049 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional(),
13050 original)
13051{
13052}
13053
13054template <class t_TYPE>
13055template <class t_ANY_TYPE>
13056optional<t_TYPE>::optional(
13057 bsl::allocator_arg_t,
13058 AllocType allocator,
13059 const optional<t_ANY_TYPE>& original,
13061 const t_ANY_TYPE&),
13062 BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE&))
13063: BaseType(bsl::allocator_arg_t(),
13064 allocator,
13065 BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional(),
13066 original)
13067{
13068}
13069
13070template <class t_TYPE>
13071template <class t_ANY_TYPE>
13072optional<t_TYPE>::optional(
13073 bsl::allocator_arg_t,
13074 AllocType allocator,
13075 BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
13078: BaseType(bsl::allocator_arg_t(),
13079 allocator,
13080 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional(),
13081 MoveUtil::move(
13082 static_cast<BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>&>(
13083 original)))
13084{
13085}
13086
13087template <class t_TYPE>
13088template <class t_ANY_TYPE>
13089optional<t_TYPE>::optional(
13090 bsl::allocator_arg_t,
13091 AllocType allocator,
13092 BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
13095: BaseType(bsl::allocator_arg_t(),
13096 allocator,
13097 BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional(),
13098 MoveUtil::move(
13099 static_cast<BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>&>(
13100 original)))
13101{
13102}
13103
13104#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
13105template <class t_TYPE>
13106template <class t_ANY_TYPE>
13107optional<t_TYPE>::optional(
13108 bsl::allocator_arg_t,
13109 AllocType allocator,
13110 const std::optional<t_ANY_TYPE>& original,
13112 const t_ANY_TYPE&),
13114 const t_ANY_TYPE&))
13115: BaseType(bsl::allocator_arg_t(),
13116 allocator,
13117 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional(),
13118 original)
13119{
13120}
13121
13122template <class t_TYPE>
13123template <class t_ANY_TYPE>
13124optional<t_TYPE>::optional(
13125 bsl::allocator_arg_t,
13126 AllocType allocator,
13127 const std::optional<t_ANY_TYPE>& original,
13129 const t_ANY_TYPE&),
13130 BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE))
13131: BaseType(bsl::allocator_arg_t(),
13132 allocator,
13133 BloombergLP::bslstl::Optional_CopyConstructFromStdOptional(),
13134 original)
13135{
13136}
13137
13138template <class t_TYPE>
13139template <class t_ANY_TYPE>
13140optional<t_TYPE>::optional(
13141 bsl::allocator_arg_t,
13142 AllocType allocator,
13143 std::optional<t_ANY_TYPE>&& original,
13146: BaseType(bsl::allocator_arg_t(),
13147 allocator,
13148 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional(),
13149 std::move(original))
13150{
13151}
13152
13153template <class t_TYPE>
13154template <class t_ANY_TYPE>
13155optional<t_TYPE>::optional(
13156 bsl::allocator_arg_t,
13157 AllocType allocator,
13158 std::optional<t_ANY_TYPE>&& original,
13161: BaseType(bsl::allocator_arg_t(),
13162 allocator,
13163 BloombergLP::bslstl::Optional_MoveConstructFromStdOptional(),
13164 std::move(original))
13165{
13166}
13167# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
13168
13169#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
13170// {{{ BEGIN GENERATED CODE
13171// Command line: sim_cpp11_features.pl bslstl_optional.h
13172#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
13173#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
13174#endif
13175#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_T
13176#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_T BSLSTL_OPTIONAL_VARIADIC_LIMIT
13177#endif
13178#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0
13179template <class t_TYPE>
13180optional<t_TYPE>::optional(
13181 bsl::allocator_arg_t,
13182 AllocType allocator,
13184: BaseType(bsl::allocator_arg,
13185 allocator,
13186 bsl::in_place)
13187{
13188}
13189#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0
13190
13191#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1
13192template <class t_TYPE>
13193template <class t_ARGS_01>
13194optional<t_TYPE>::optional(
13195 bsl::allocator_arg_t,
13196 AllocType allocator,
13198 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
13199: BaseType(bsl::allocator_arg,
13200 allocator,
13201 bsl::in_place,
13202 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01))
13203{
13204}
13205#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1
13206
13207#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2
13208template <class t_TYPE>
13209template <class t_ARGS_01,
13210 class t_ARGS_02>
13211optional<t_TYPE>::optional(
13212 bsl::allocator_arg_t,
13213 AllocType allocator,
13215 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13216 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
13217: BaseType(bsl::allocator_arg,
13218 allocator,
13219 bsl::in_place,
13220 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13221 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02))
13222{
13223}
13224#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2
13225
13226#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3
13227template <class t_TYPE>
13228template <class t_ARGS_01,
13229 class t_ARGS_02,
13230 class t_ARGS_03>
13231optional<t_TYPE>::optional(
13232 bsl::allocator_arg_t,
13233 AllocType allocator,
13235 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13236 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13237 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
13238: BaseType(bsl::allocator_arg,
13239 allocator,
13240 bsl::in_place,
13241 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13242 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13243 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03))
13244{
13245}
13246#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3
13247
13248#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4
13249template <class t_TYPE>
13250template <class t_ARGS_01,
13251 class t_ARGS_02,
13252 class t_ARGS_03,
13253 class t_ARGS_04>
13254optional<t_TYPE>::optional(
13255 bsl::allocator_arg_t,
13256 AllocType allocator,
13258 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13259 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13260 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13261 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
13262: BaseType(bsl::allocator_arg,
13263 allocator,
13264 bsl::in_place,
13265 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13266 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13267 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13268 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04))
13269{
13270}
13271#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4
13272
13273#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5
13274template <class t_TYPE>
13275template <class t_ARGS_01,
13276 class t_ARGS_02,
13277 class t_ARGS_03,
13278 class t_ARGS_04,
13279 class t_ARGS_05>
13280optional<t_TYPE>::optional(
13281 bsl::allocator_arg_t,
13282 AllocType allocator,
13284 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13285 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13286 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13287 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13288 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
13289: BaseType(bsl::allocator_arg,
13290 allocator,
13291 bsl::in_place,
13292 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13293 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13294 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13295 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13296 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05))
13297{
13298}
13299#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5
13300
13301#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6
13302template <class t_TYPE>
13303template <class t_ARGS_01,
13304 class t_ARGS_02,
13305 class t_ARGS_03,
13306 class t_ARGS_04,
13307 class t_ARGS_05,
13308 class t_ARGS_06>
13309optional<t_TYPE>::optional(
13310 bsl::allocator_arg_t,
13311 AllocType allocator,
13313 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13314 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13315 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13316 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13317 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13318 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
13319: BaseType(bsl::allocator_arg,
13320 allocator,
13321 bsl::in_place,
13322 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13323 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13324 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13325 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13326 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13327 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06))
13328{
13329}
13330#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6
13331
13332#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7
13333template <class t_TYPE>
13334template <class t_ARGS_01,
13335 class t_ARGS_02,
13336 class t_ARGS_03,
13337 class t_ARGS_04,
13338 class t_ARGS_05,
13339 class t_ARGS_06,
13340 class t_ARGS_07>
13341optional<t_TYPE>::optional(
13342 bsl::allocator_arg_t,
13343 AllocType allocator,
13345 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13346 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13347 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13348 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13349 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13350 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
13351 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
13352: BaseType(bsl::allocator_arg,
13353 allocator,
13354 bsl::in_place,
13355 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13356 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13357 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13358 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13359 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13360 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
13361 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07))
13362{
13363}
13364#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7
13365
13366#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8
13367template <class t_TYPE>
13368template <class t_ARGS_01,
13369 class t_ARGS_02,
13370 class t_ARGS_03,
13371 class t_ARGS_04,
13372 class t_ARGS_05,
13373 class t_ARGS_06,
13374 class t_ARGS_07,
13375 class t_ARGS_08>
13376optional<t_TYPE>::optional(
13377 bsl::allocator_arg_t,
13378 AllocType allocator,
13380 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13381 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13382 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13383 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13384 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13385 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
13386 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
13387 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
13388: BaseType(bsl::allocator_arg,
13389 allocator,
13390 bsl::in_place,
13391 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13392 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13393 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13394 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13395 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13396 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
13397 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
13398 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08))
13399{
13400}
13401#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8
13402
13403#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9
13404template <class t_TYPE>
13405template <class t_ARGS_01,
13406 class t_ARGS_02,
13407 class t_ARGS_03,
13408 class t_ARGS_04,
13409 class t_ARGS_05,
13410 class t_ARGS_06,
13411 class t_ARGS_07,
13412 class t_ARGS_08,
13413 class t_ARGS_09>
13414optional<t_TYPE>::optional(
13415 bsl::allocator_arg_t,
13416 AllocType allocator,
13418 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13419 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13420 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13421 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13422 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13423 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
13424 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
13425 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
13426 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
13427: BaseType(bsl::allocator_arg,
13428 allocator,
13429 bsl::in_place,
13430 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13431 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13432 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13433 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13434 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13435 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
13436 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
13437 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
13438 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09))
13439{
13440}
13441#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9
13442
13443#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10
13444template <class t_TYPE>
13445template <class t_ARGS_01,
13446 class t_ARGS_02,
13447 class t_ARGS_03,
13448 class t_ARGS_04,
13449 class t_ARGS_05,
13450 class t_ARGS_06,
13451 class t_ARGS_07,
13452 class t_ARGS_08,
13453 class t_ARGS_09,
13454 class t_ARGS_10>
13455optional<t_TYPE>::optional(
13456 bsl::allocator_arg_t,
13457 AllocType allocator,
13459 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13460 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13461 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13462 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13463 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13464 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
13465 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
13466 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
13467 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
13468 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
13469: BaseType(bsl::allocator_arg,
13470 allocator,
13471 bsl::in_place,
13472 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13473 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13474 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13475 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13476 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13477 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
13478 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
13479 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
13480 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
13481 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10))
13482{
13483}
13484#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10
13485
13486#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
13487#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0
13488template <class t_TYPE>
13489template <class t_INIT_LIST_TYPE>
13490optional<t_TYPE>::optional(
13491 bsl::allocator_arg_t,
13492 AllocType allocator,
13494 std::initializer_list<t_INIT_LIST_TYPE> il)
13495: BaseType(bsl::allocator_arg,
13496 allocator,
13497 bsl::in_place,
13498 il)
13499{
13500}
13501#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0
13502
13503#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1
13504template <class t_TYPE>
13505template <class t_INIT_LIST_TYPE, class t_ARGS_01>
13506optional<t_TYPE>::optional(
13507 bsl::allocator_arg_t,
13508 AllocType allocator,
13510 std::initializer_list<t_INIT_LIST_TYPE> il,
13511 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
13512: BaseType(bsl::allocator_arg,
13513 allocator,
13514 bsl::in_place,
13515 il,
13516 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01))
13517{
13518}
13519#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1
13520
13521#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2
13522template <class t_TYPE>
13523template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13524 class t_ARGS_02>
13525optional<t_TYPE>::optional(
13526 bsl::allocator_arg_t,
13527 AllocType allocator,
13529 std::initializer_list<t_INIT_LIST_TYPE> il,
13530 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13531 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
13532: BaseType(bsl::allocator_arg,
13533 allocator,
13534 bsl::in_place,
13535 il,
13536 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13537 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02))
13538{
13539}
13540#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2
13541
13542#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3
13543template <class t_TYPE>
13544template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13545 class t_ARGS_02,
13546 class t_ARGS_03>
13547optional<t_TYPE>::optional(
13548 bsl::allocator_arg_t,
13549 AllocType allocator,
13551 std::initializer_list<t_INIT_LIST_TYPE> il,
13552 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13553 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13554 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
13555: BaseType(bsl::allocator_arg,
13556 allocator,
13557 bsl::in_place,
13558 il,
13559 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13560 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13561 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03))
13562{
13563}
13564#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3
13565
13566#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4
13567template <class t_TYPE>
13568template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13569 class t_ARGS_02,
13570 class t_ARGS_03,
13571 class t_ARGS_04>
13572optional<t_TYPE>::optional(
13573 bsl::allocator_arg_t,
13574 AllocType allocator,
13576 std::initializer_list<t_INIT_LIST_TYPE> il,
13577 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13578 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13579 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13580 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
13581: BaseType(bsl::allocator_arg,
13582 allocator,
13583 bsl::in_place,
13584 il,
13585 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13586 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13587 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13588 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04))
13589{
13590}
13591#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4
13592
13593#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5
13594template <class t_TYPE>
13595template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13596 class t_ARGS_02,
13597 class t_ARGS_03,
13598 class t_ARGS_04,
13599 class t_ARGS_05>
13600optional<t_TYPE>::optional(
13601 bsl::allocator_arg_t,
13602 AllocType allocator,
13604 std::initializer_list<t_INIT_LIST_TYPE> il,
13605 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13606 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13607 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13608 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13609 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
13610: BaseType(bsl::allocator_arg,
13611 allocator,
13612 bsl::in_place,
13613 il,
13614 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13615 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13616 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13617 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13618 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05))
13619{
13620}
13621#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5
13622
13623#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6
13624template <class t_TYPE>
13625template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13626 class t_ARGS_02,
13627 class t_ARGS_03,
13628 class t_ARGS_04,
13629 class t_ARGS_05,
13630 class t_ARGS_06>
13631optional<t_TYPE>::optional(
13632 bsl::allocator_arg_t,
13633 AllocType allocator,
13635 std::initializer_list<t_INIT_LIST_TYPE> il,
13636 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13637 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13638 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13639 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13640 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13641 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
13642: BaseType(bsl::allocator_arg,
13643 allocator,
13644 bsl::in_place,
13645 il,
13646 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13647 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13648 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13649 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13650 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13651 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06))
13652{
13653}
13654#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6
13655
13656#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7
13657template <class t_TYPE>
13658template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13659 class t_ARGS_02,
13660 class t_ARGS_03,
13661 class t_ARGS_04,
13662 class t_ARGS_05,
13663 class t_ARGS_06,
13664 class t_ARGS_07>
13665optional<t_TYPE>::optional(
13666 bsl::allocator_arg_t,
13667 AllocType allocator,
13669 std::initializer_list<t_INIT_LIST_TYPE> il,
13670 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13671 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13672 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13673 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13674 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13675 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
13676 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
13677: BaseType(bsl::allocator_arg,
13678 allocator,
13679 bsl::in_place,
13680 il,
13681 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13682 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13683 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13684 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13685 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13686 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
13687 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07))
13688{
13689}
13690#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7
13691
13692#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8
13693template <class t_TYPE>
13694template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13695 class t_ARGS_02,
13696 class t_ARGS_03,
13697 class t_ARGS_04,
13698 class t_ARGS_05,
13699 class t_ARGS_06,
13700 class t_ARGS_07,
13701 class t_ARGS_08>
13702optional<t_TYPE>::optional(
13703 bsl::allocator_arg_t,
13704 AllocType allocator,
13706 std::initializer_list<t_INIT_LIST_TYPE> il,
13707 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13708 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13709 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13710 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13711 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13712 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
13713 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
13714 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
13715: BaseType(bsl::allocator_arg,
13716 allocator,
13717 bsl::in_place,
13718 il,
13719 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13720 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13721 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13722 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13723 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13724 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
13725 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
13726 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08))
13727{
13728}
13729#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8
13730
13731#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9
13732template <class t_TYPE>
13733template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13734 class t_ARGS_02,
13735 class t_ARGS_03,
13736 class t_ARGS_04,
13737 class t_ARGS_05,
13738 class t_ARGS_06,
13739 class t_ARGS_07,
13740 class t_ARGS_08,
13741 class t_ARGS_09>
13742optional<t_TYPE>::optional(
13743 bsl::allocator_arg_t,
13744 AllocType allocator,
13746 std::initializer_list<t_INIT_LIST_TYPE> il,
13747 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13748 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13749 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13750 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13751 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13752 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
13753 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
13754 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
13755 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
13756: BaseType(bsl::allocator_arg,
13757 allocator,
13758 bsl::in_place,
13759 il,
13760 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13761 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13762 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13763 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13764 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13765 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
13766 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
13767 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
13768 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09))
13769{
13770}
13771#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9
13772
13773#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10
13774template <class t_TYPE>
13775template <class t_INIT_LIST_TYPE, class t_ARGS_01,
13776 class t_ARGS_02,
13777 class t_ARGS_03,
13778 class t_ARGS_04,
13779 class t_ARGS_05,
13780 class t_ARGS_06,
13781 class t_ARGS_07,
13782 class t_ARGS_08,
13783 class t_ARGS_09,
13784 class t_ARGS_10>
13785optional<t_TYPE>::optional(
13786 bsl::allocator_arg_t,
13787 AllocType allocator,
13789 std::initializer_list<t_INIT_LIST_TYPE> il,
13790 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
13791 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
13792 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
13793 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
13794 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
13795 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
13796 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
13797 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
13798 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
13799 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
13800: BaseType(bsl::allocator_arg,
13801 allocator,
13802 bsl::in_place,
13803 il,
13804 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
13805 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
13806 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
13807 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
13808 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
13809 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
13810 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
13811 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
13812 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
13813 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10))
13814{
13815}
13816#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10
13817
13818#endif
13819#else
13820// The generated code below is a workaround for the absence of perfect
13821// forwarding in some compilers.
13822template <class t_TYPE>
13823template <class... t_ARGS>
13824optional<t_TYPE>::optional(
13825 bsl::allocator_arg_t,
13826 AllocType allocator,
13828 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
13829: BaseType(bsl::allocator_arg,
13830 allocator,
13831 bsl::in_place,
13832 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...)
13833{
13834}
13835#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
13836template <class t_TYPE>
13837template <class t_INIT_LIST_TYPE, class... t_ARGS>
13838optional<t_TYPE>::optional(
13839 bsl::allocator_arg_t,
13840 AllocType allocator,
13842 std::initializer_list<t_INIT_LIST_TYPE> il,
13843 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
13844: BaseType(bsl::allocator_arg,
13845 allocator,
13846 bsl::in_place,
13847 il,
13848 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...)
13849{
13850}
13851#endif
13852// }}} END GENERATED CODE
13853#endif
13854
13855// MANIPULATORS
13856template <class t_TYPE>
13857optional<t_TYPE>&
13858optional<t_TYPE>::operator=(bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT
13859{
13860 this->reset();
13861 return *this;
13862}
13863
13864#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
13865template <class t_TYPE>
13866template <class t_DERIVED>
13868optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_DERIVED> rhs)
13869{
13870 BaseType& lvalue = rhs;
13871 BaseType::operator=(MoveUtil::move(lvalue));
13872 return *this;
13873}
13874#endif
13875
13876template <class t_TYPE>
13877template <class t_ANY_TYPE>
13878BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE&)&
13879optional<t_TYPE>::operator=(const optional<t_ANY_TYPE>& rhs)
13880{
13881 if (rhs.has_value()) {
13882 this->assignOrEmplace(*rhs);
13883 } else {
13884 this->reset();
13885 }
13886 return *this;
13887}
13888
13889template <class t_TYPE>
13890template <class t_ANY_TYPE>
13892optional<t_TYPE>::operator=(BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) rhs)
13893{
13894 BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>& lvalue = rhs;
13895 if (lvalue.has_value()) {
13896 this->assignOrEmplace(MoveUtil::move(*lvalue));
13897 } else {
13898 this->reset();
13899 }
13900 return *this;
13901}
13902
13903#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
13904template <class t_TYPE>
13905template <class t_ANY_TYPE>
13907optional<t_TYPE>::operator=(t_ANY_TYPE&& rhs)
13908{
13909 this->assignOrEmplace(std::forward<t_ANY_TYPE>(rhs));
13910 return *this;
13911}
13912#else
13913template <class t_TYPE>
13914optional<t_TYPE>& optional<t_TYPE>::operator=(const t_TYPE& rhs)
13915{
13916 this->assignOrEmplace(rhs);
13917 return *this;
13918}
13919
13920template <class t_TYPE>
13921optional<t_TYPE>&
13922optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_TYPE> rhs)
13923{
13924 this->assignOrEmplace(MoveUtil::move(rhs));
13925 return *this;
13926}
13927
13928template <class t_TYPE>
13929template <class t_ANY_TYPE>
13931optional<t_TYPE>::operator=(const t_ANY_TYPE& rhs)
13932{
13933 this->assignOrEmplace(rhs);
13934 return *this;
13935}
13936
13937template <class t_TYPE>
13938template <class t_ANY_TYPE>
13940optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_ANY_TYPE> rhs)
13941{
13942 this->assignOrEmplace(MoveUtil::move(rhs));
13943 return *this;
13944}
13945#endif // RVALUES else
13946
13947#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
13948template <class t_TYPE>
13949template <class t_ANY_TYPE>
13950BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(t_TYPE, const t_ANY_TYPE&)&
13951optional<t_TYPE>::operator=(const std::optional<t_ANY_TYPE>& rhs)
13952{
13953 if (rhs.has_value()) {
13954 this->assignOrEmplace(*rhs);
13955 } else {
13956 this->reset();
13957 }
13958 return *this;
13959}
13960
13961template <class t_TYPE>
13962template <class t_ANY_TYPE>
13964optional<t_TYPE>::operator=(std::optional<t_ANY_TYPE>&& rhs)
13965{
13966 if (rhs.has_value()) {
13967 this->assignOrEmplace(std::move(*rhs));
13968 } else {
13969 this->reset();
13970 }
13971 return *this;
13972}
13973# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
13974
13975// ============================================================================
13976// Section: Free Function Definitions
13977// ============================================================================
13978
13979template <class t_TYPE>
13980inline
13982 void>::type
13984{
13985 if (lhs.get_allocator() == rhs.get_allocator()) {
13986 lhs.swap(rhs);
13987
13988 return; // RETURN
13989 }
13990
13991 bsl::optional<t_TYPE> futureLhs(
13992 bsl::allocator_arg, lhs.get_allocator(), rhs);
13993 bsl::optional<t_TYPE> futureRhs(
13994 bsl::allocator_arg, rhs.get_allocator(), lhs);
13995
13996 futureLhs.swap(lhs);
13997 futureRhs.swap(rhs);
13998}
13999
14000template <class t_TYPE>
14001inline
14003 void>::type
14005{
14006 lhs.swap(rhs);
14007}
14008
14009// HASH SPECIALIZATIONS
14010template <class t_HASHALG, class t_TYPE>
14011void hashAppend(t_HASHALG& hashAlg, const bsl::optional<t_TYPE>& input)
14012{
14013 using ::BloombergLP::bslh::hashAppend;
14014
14015 if (input.has_value()) {
14016 hashAppend(hashAlg, true);
14017 hashAppend(hashAlg, *input);
14018 }
14019 else {
14020 hashAppend(hashAlg, false);
14021 }
14022}
14023
14024// FREE OPERATORS
14025
14026template <class t_LHS_TYPE, class t_RHS_TYPE>
14028 const bsl::optional<t_RHS_TYPE>& rhs)
14029 BSLSTL_OPTIONAL_REQUIRES(requires {
14030 { *lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14031 })
14032{
14033 if (lhs.has_value() && rhs.has_value()) {
14034 return *lhs == *rhs; // RETURN
14035 }
14036 return lhs.has_value() == rhs.has_value();
14037}
14038
14039template <class t_LHS_TYPE, class t_RHS_TYPE>
14041 const bsl::optional<t_RHS_TYPE>& rhs)
14042 BSLSTL_OPTIONAL_REQUIRES(requires {
14043 { *lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14044 })
14045{
14046 if (lhs.has_value() && rhs.has_value()) {
14047 return *lhs != *rhs; // RETURN
14048 }
14049
14050 return lhs.has_value() != rhs.has_value();
14051}
14052
14053template <class t_LHS_TYPE, class t_RHS_TYPE>
14054bool operator<(const bsl::optional<t_LHS_TYPE>& lhs,
14055 const bsl::optional<t_RHS_TYPE>& rhs)
14056 BSLSTL_OPTIONAL_REQUIRES(requires {
14057 { *lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14058 })
14059{
14060 if (!rhs.has_value()) {
14061 return false; // RETURN
14062 }
14063
14064 return !lhs.has_value() || *lhs < *rhs;
14065}
14066
14067template <class t_LHS_TYPE, class t_RHS_TYPE>
14068bool operator>(const bsl::optional<t_LHS_TYPE>& lhs,
14069 const bsl::optional<t_RHS_TYPE>& rhs)
14070 BSLSTL_OPTIONAL_REQUIRES(requires {
14071 { *lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14072 })
14073{
14074 if (!lhs.has_value()) {
14075 return false; // RETURN
14076 }
14077
14078 return !rhs.has_value() || *lhs > *rhs;
14079}
14080
14081template <class t_LHS_TYPE, class t_RHS_TYPE>
14083 const bsl::optional<t_RHS_TYPE>& rhs)
14084 BSLSTL_OPTIONAL_REQUIRES(requires {
14085 { *lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14086 })
14087{
14088 if (!lhs.has_value()) {
14089 return true; // RETURN
14090 }
14091
14092 return rhs.has_value() && *lhs <= *rhs;
14093}
14094
14095template <class t_LHS_TYPE, class t_RHS_TYPE>
14097 const bsl::optional<t_RHS_TYPE>& rhs)
14098 BSLSTL_OPTIONAL_REQUIRES(requires {
14099 { *lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14100 })
14101{
14102 if (!rhs.has_value()) {
14103 return true; // RETURN
14104 }
14105 return lhs.has_value() && *lhs >= *rhs;
14106}
14107
14108// comparison with 'nullopt_t'
14109
14110template <class t_TYPE>
14111inline
14113 const bsl::optional<t_TYPE>& value,
14115{
14116 return !value.has_value();
14117}
14118
14119#if !(defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) && \
14120 defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS))
14121template <class t_TYPE>
14122inline
14124 const bsl::nullopt_t&,
14126{
14127 return !value.has_value();
14128}
14129
14130template <class t_TYPE>
14131inline
14133 const bsl::optional<t_TYPE>& value,
14135{
14136 return value.has_value();
14137}
14138
14139template <class t_TYPE>
14140inline
14142 const bsl::nullopt_t&,
14144{
14145 return value.has_value();
14146}
14147
14148template <class t_TYPE>
14149inline
14151 const bsl::optional<t_TYPE>&,
14153{
14154 return false;
14155}
14156
14157template <class t_TYPE>
14158inline
14160 const bsl::nullopt_t&,
14162{
14163 return value.has_value();
14164}
14165
14166template <class t_TYPE>
14167inline
14169 const bsl::optional<t_TYPE>& value,
14171{
14172 return value.has_value();
14173}
14174
14175template <class t_TYPE>
14176inline
14178 const bsl::nullopt_t&,
14180{
14181 return false;
14182}
14183
14184template <class t_TYPE>
14185inline
14187 const bsl::optional<t_TYPE>& value,
14189{
14190 return !value.has_value();
14191}
14192
14193template <class t_TYPE>
14194inline
14196 const bsl::nullopt_t&,
14198{
14199 return true;
14200}
14201
14202template <class t_TYPE>
14203inline
14205 const bsl::optional<t_TYPE>&,
14207{
14208 return true;
14209}
14210
14211template <class t_TYPE>
14212inline
14214 const bsl::nullopt_t&,
14216{
14217 return !value.has_value();
14218}
14219#endif // !(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS &&
14220 // BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON)
14221
14222// comparison with 'value_type'
14223
14224template <class t_LHS_TYPE, class t_RHS_TYPE>
14225bool operator==(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
14227 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
14228 && requires {
14229 { *lhs == rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14230 })
14231{
14232 return lhs.has_value() && *lhs == rhs;
14233}
14234
14235template <class t_LHS_TYPE, class t_RHS_TYPE>
14236bool operator==(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
14238 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
14239 && requires {
14240 { lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14241 })
14242{
14243 return rhs.has_value() && lhs == *rhs;
14244}
14245
14246template <class t_LHS_TYPE, class t_RHS_TYPE>
14247bool operator!=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
14249 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
14250 && requires {
14251 { *lhs != rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14252 })
14253{
14254 return !lhs.has_value() || *lhs != rhs;
14255}
14256
14257template <class t_LHS_TYPE, class t_RHS_TYPE>
14258bool operator!=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
14260 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
14261 && requires {
14262 { lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14263 })
14264{
14265 return !rhs.has_value() || lhs != *rhs;
14266}
14267
14268template <class t_LHS_TYPE, class t_RHS_TYPE>
14269bool operator<(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
14271 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
14272 && requires {
14273 { *lhs < rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14274 })
14275{
14276 return !lhs.has_value() || *lhs < rhs;
14277}
14278
14279template <class t_LHS_TYPE, class t_RHS_TYPE>
14280bool operator<(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
14282 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
14283 && requires {
14284 { lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14285 })
14286{
14287 return rhs.has_value() && lhs < *rhs;
14288}
14289
14290template <class t_LHS_TYPE, class t_RHS_TYPE>
14291bool operator>(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
14293 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
14294 && requires {
14295 { *lhs > rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14296 })
14297{
14298 return lhs.has_value() && *lhs > rhs;
14299}
14300
14301template <class t_LHS_TYPE, class t_RHS_TYPE>
14302bool operator>(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
14304 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
14305 && requires {
14306 { lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14307 })
14308{
14309 return !rhs.has_value() || lhs > *rhs;
14310}
14311
14312template <class t_LHS_TYPE, class t_RHS_TYPE>
14313bool operator<=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
14315 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
14316 && requires {
14317 { *lhs <= rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14318 })
14319{
14320 return !lhs.has_value() || *lhs <= rhs;
14321}
14322
14323template <class t_LHS_TYPE, class t_RHS_TYPE>
14324bool operator<=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
14326 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
14327 && requires {
14328 { lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14329 })
14330{
14331 return rhs.has_value() && lhs <= *rhs;
14332}
14333
14334template <class t_LHS_TYPE, class t_RHS_TYPE>
14335bool operator>=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
14337 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
14338 && requires {
14339 { *lhs >= rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14340 })
14341{
14342 return lhs.has_value() && *lhs >= rhs;
14343}
14344
14345template <class t_LHS_TYPE, class t_RHS_TYPE>
14346bool operator>=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
14348 !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
14349 && requires {
14350 { lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
14351 })
14352{
14353 return !rhs.has_value() || lhs >= *rhs;
14354}
14355
14356#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
14357 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
14358template <class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
14359constexpr compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
14360 const bsl::optional<t_LHS>& lhs,
14361 const bsl::optional<t_RHS>& rhs)
14362{
14363 const bool lhs_has_value = lhs.has_value(),
14364 rhs_has_value = rhs.has_value();
14365 if (lhs_has_value && rhs_has_value) {
14366 return *lhs <=> *rhs;
14367 }
14368 return lhs_has_value <=> rhs_has_value;
14369}
14370
14371template <class t_LHS, class t_RHS>
14372requires (!BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS>) &&
14373 three_way_comparable_with<t_LHS, t_RHS>
14374constexpr compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
14375 const bsl::optional<t_LHS>& lhs,
14376 const t_RHS& rhs)
14377{
14378 if (lhs) {
14379 return *lhs <=> rhs;
14380 }
14381 return strong_ordering::less;
14382}
14383
14384template <class t_TYPE>
14385constexpr strong_ordering operator<=>(const bsl::optional<t_TYPE>& value,
14387{
14388 return value.has_value() <=> false;
14389}
14390
14391template <class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
14392constexpr compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
14393 const bsl::optional<t_LHS>& lhs,
14394 const std::optional<t_RHS>& rhs)
14395{
14396 const bool lhs_has_value = lhs.has_value(),
14397 rhs_has_value = rhs.has_value();
14398 if (lhs_has_value && rhs_has_value) {
14399 return *lhs <=> *rhs;
14400 }
14401 return lhs_has_value <=> rhs_has_value;
14402}
14403#endif // BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON &&
14404 // BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
14405
14406# ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
14407template <class t_TYPE>
14408inline
14410 void>::type
14411swap(bsl::optional<t_TYPE>& lhs, std::optional<t_TYPE>& rhs)
14412{
14413 lhs.swap(rhs);
14414}
14415
14416template <class t_TYPE>
14417inline
14419 void>::type
14420swap(std::optional<t_TYPE>& lhs, bsl::optional<t_TYPE>& rhs)
14421{
14422 lhs.swap(rhs);
14423}
14424
14425// comparison with 'std::optional'
14426
14427template <class t_LHS_TYPE, class t_RHS_TYPE>
14428inline
14430 const std::optional<t_RHS_TYPE>& rhs)
14431{
14432 if (lhs.has_value() && rhs.has_value()) {
14433 return *lhs == *rhs;
14434 }
14435 return lhs.has_value() == rhs.has_value();
14436}
14437
14438template <class t_LHS_TYPE, class t_RHS_TYPE>
14439inline
14440bool operator==(const std::optional<t_LHS_TYPE>& lhs,
14441 const bsl::optional<t_RHS_TYPE>& rhs)
14442{
14443 if (lhs.has_value() && rhs.has_value()) {
14444 return *lhs == *rhs;
14445 }
14446 return lhs.has_value() == rhs.has_value();
14447}
14448
14449template <class t_LHS_TYPE, class t_RHS_TYPE>
14450inline
14452 const std::optional<t_RHS_TYPE>& rhs)
14453{
14454 if (lhs.has_value() && rhs.has_value()) {
14455 return *lhs != *rhs;
14456 }
14457
14458 return lhs.has_value() != rhs.has_value();
14459}
14460
14461template <class t_LHS_TYPE, class t_RHS_TYPE>
14462inline
14463bool operator!=(const std::optional<t_LHS_TYPE>& lhs,
14464 const bsl::optional<t_RHS_TYPE>& rhs)
14465{
14466 if (lhs.has_value() && rhs.has_value()) {
14467 return *lhs != *rhs;
14468 }
14469
14470 return lhs.has_value() != rhs.has_value();
14471}
14472
14473template <class t_LHS_TYPE, class t_RHS_TYPE>
14474inline
14475bool operator<(const bsl::optional<t_LHS_TYPE>& lhs,
14476 const std::optional<t_RHS_TYPE>& rhs)
14477{
14478 if (!rhs.has_value()) {
14479 return false; // RETURN
14480 }
14481
14482 return !lhs.has_value() || *lhs < *rhs;
14483}
14484
14485template <class t_LHS_TYPE, class t_RHS_TYPE>
14486inline
14487bool operator<(const std::optional<t_LHS_TYPE>& lhs,
14488 const bsl::optional<t_RHS_TYPE>& rhs)
14489{
14490 if (!rhs.has_value()) {
14491 return false; // RETURN
14492 }
14493
14494 return !lhs.has_value() || *lhs < *rhs;
14495}
14496
14497template <class t_LHS_TYPE, class t_RHS_TYPE>
14498inline
14499bool operator>(const bsl::optional<t_LHS_TYPE>& lhs,
14500 const std::optional<t_RHS_TYPE>& rhs)
14501{
14502 if (!lhs.has_value()) {
14503 return false; // RETURN
14504 }
14505
14506 return !rhs.has_value() || *lhs > *rhs;
14507}
14508
14509template <class t_LHS_TYPE, class t_RHS_TYPE>
14510inline
14511bool operator>(const std::optional<t_LHS_TYPE>& lhs,
14512 const bsl::optional<t_RHS_TYPE>& rhs)
14513{
14514 if (!lhs.has_value()) {
14515 return false; // RETURN
14516 }
14517
14518 return !rhs.has_value() || *lhs > *rhs;
14519}
14520
14521template <class t_LHS_TYPE, class t_RHS_TYPE>
14522inline
14524 const std::optional<t_RHS_TYPE>& rhs)
14525{
14526 if (!lhs.has_value()) {
14527 return true; // RETURN
14528 }
14529
14530 return rhs.has_value() && *lhs <= *rhs;
14531}
14532
14533template <class t_LHS_TYPE, class t_RHS_TYPE>
14534inline
14535bool operator<=(const std::optional<t_LHS_TYPE>& lhs,
14536 const bsl::optional<t_RHS_TYPE>& rhs)
14537{
14538 if (!lhs.has_value()) {
14539 return true; // RETURN
14540 }
14541
14542 return rhs.has_value() && *lhs <= *rhs;
14543}
14544
14545template <class t_LHS_TYPE, class t_RHS_TYPE>
14546inline
14548 const std::optional<t_RHS_TYPE>& rhs)
14549{
14550 if (!rhs.has_value()) {
14551 return true; // RETURN
14552 }
14553 return lhs.has_value() && *lhs >= *rhs;
14554}
14555
14556template <class t_LHS_TYPE, class t_RHS_TYPE>
14557inline
14558bool operator>=(const std::optional<t_LHS_TYPE>& lhs,
14559 const bsl::optional<t_RHS_TYPE>& rhs)
14560{
14561 if (!rhs.has_value()) {
14562 return true; // RETURN
14563 }
14564 return lhs.has_value() && *lhs >= *rhs;
14565}
14566# endif // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
14567
14568template <class t_TYPE>
14570make_optional(bsl::allocator_arg_t,
14571 const typename bsl::optional<
14572 typename bsl::decay<t_TYPE>::type>::allocator_type& alloc,
14574{
14576 bsl::allocator_arg,
14577 alloc,
14579 BSLS_COMPILERFEATURES_FORWARD(t_TYPE, rhs));
14580}
14581
14582#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
14583// {{{ BEGIN GENERATED CODE
14584// Command line: sim_cpp11_features.pl bslstl_optional.h
14585#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
14586#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
14587#endif
14588#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_U
14589#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_U BSLSTL_OPTIONAL_VARIADIC_LIMIT
14590#endif
14591#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 0
14592template <class t_TYPE>
14594 bsl::allocator_arg_t,
14595 typename bsl::optional<t_TYPE>::allocator_type const& alloc)
14596{
14597 return bsl::optional<t_TYPE>(
14598 bsl::allocator_arg,
14599 alloc,
14601}
14602#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 0
14603
14604#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 1
14605template <class t_TYPE, class t_ARGS_01>
14607 bsl::allocator_arg_t,
14608 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14609 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
14610{
14611 return bsl::optional<t_TYPE>(
14612 bsl::allocator_arg,
14613 alloc,
14615 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
14616}
14617#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 1
14618
14619#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 2
14620template <class t_TYPE, class t_ARGS_01,
14621 class t_ARGS_02>
14623 bsl::allocator_arg_t,
14624 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14625 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14626 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
14627{
14628 return bsl::optional<t_TYPE>(
14629 bsl::allocator_arg,
14630 alloc,
14632 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14633 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
14634}
14635#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 2
14636
14637#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 3
14638template <class t_TYPE, class t_ARGS_01,
14639 class t_ARGS_02,
14640 class t_ARGS_03>
14642 bsl::allocator_arg_t,
14643 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14644 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14645 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14646 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
14647{
14648 return bsl::optional<t_TYPE>(
14649 bsl::allocator_arg,
14650 alloc,
14652 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14653 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14654 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
14655}
14656#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 3
14657
14658#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 4
14659template <class t_TYPE, class t_ARGS_01,
14660 class t_ARGS_02,
14661 class t_ARGS_03,
14662 class t_ARGS_04>
14664 bsl::allocator_arg_t,
14665 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14666 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14667 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14668 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
14669 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
14670{
14671 return bsl::optional<t_TYPE>(
14672 bsl::allocator_arg,
14673 alloc,
14675 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14676 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14677 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
14678 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
14679}
14680#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 4
14681
14682#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 5
14683template <class t_TYPE, class t_ARGS_01,
14684 class t_ARGS_02,
14685 class t_ARGS_03,
14686 class t_ARGS_04,
14687 class t_ARGS_05>
14689 bsl::allocator_arg_t,
14690 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14691 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14692 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14693 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
14694 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
14695 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
14696{
14697 return bsl::optional<t_TYPE>(
14698 bsl::allocator_arg,
14699 alloc,
14701 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14702 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14703 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
14704 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
14705 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
14706}
14707#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 5
14708
14709#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 6
14710template <class t_TYPE, class t_ARGS_01,
14711 class t_ARGS_02,
14712 class t_ARGS_03,
14713 class t_ARGS_04,
14714 class t_ARGS_05,
14715 class t_ARGS_06>
14717 bsl::allocator_arg_t,
14718 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14719 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14720 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14721 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
14722 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
14723 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
14724 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
14725{
14726 return bsl::optional<t_TYPE>(
14727 bsl::allocator_arg,
14728 alloc,
14730 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14731 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14732 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
14733 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
14734 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
14735 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
14736}
14737#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 6
14738
14739#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 7
14740template <class t_TYPE, class t_ARGS_01,
14741 class t_ARGS_02,
14742 class t_ARGS_03,
14743 class t_ARGS_04,
14744 class t_ARGS_05,
14745 class t_ARGS_06,
14746 class t_ARGS_07>
14748 bsl::allocator_arg_t,
14749 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14750 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14751 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14752 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
14753 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
14754 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
14755 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
14756 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
14757{
14758 return bsl::optional<t_TYPE>(
14759 bsl::allocator_arg,
14760 alloc,
14762 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14763 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14764 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
14765 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
14766 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
14767 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
14768 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
14769}
14770#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 7
14771
14772#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 8
14773template <class t_TYPE, class t_ARGS_01,
14774 class t_ARGS_02,
14775 class t_ARGS_03,
14776 class t_ARGS_04,
14777 class t_ARGS_05,
14778 class t_ARGS_06,
14779 class t_ARGS_07,
14780 class t_ARGS_08>
14782 bsl::allocator_arg_t,
14783 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14784 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14785 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14786 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
14787 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
14788 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
14789 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
14790 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
14791 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
14792{
14793 return bsl::optional<t_TYPE>(
14794 bsl::allocator_arg,
14795 alloc,
14797 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14798 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14799 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
14800 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
14801 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
14802 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
14803 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
14804 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
14805}
14806#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 8
14807
14808#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 9
14809template <class t_TYPE, class t_ARGS_01,
14810 class t_ARGS_02,
14811 class t_ARGS_03,
14812 class t_ARGS_04,
14813 class t_ARGS_05,
14814 class t_ARGS_06,
14815 class t_ARGS_07,
14816 class t_ARGS_08,
14817 class t_ARGS_09>
14819 bsl::allocator_arg_t,
14820 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14821 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14822 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14823 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
14824 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
14825 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
14826 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
14827 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
14828 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
14829 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
14830{
14831 return bsl::optional<t_TYPE>(
14832 bsl::allocator_arg,
14833 alloc,
14835 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14836 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14837 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
14838 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
14839 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
14840 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
14841 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
14842 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
14843 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
14844}
14845#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 9
14846
14847#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 10
14848template <class t_TYPE, class t_ARGS_01,
14849 class t_ARGS_02,
14850 class t_ARGS_03,
14851 class t_ARGS_04,
14852 class t_ARGS_05,
14853 class t_ARGS_06,
14854 class t_ARGS_07,
14855 class t_ARGS_08,
14856 class t_ARGS_09,
14857 class t_ARGS_10>
14859 bsl::allocator_arg_t,
14860 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14861 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14862 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14863 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
14864 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
14865 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
14866 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
14867 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
14868 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
14869 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
14870 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
14871{
14872 return bsl::optional<t_TYPE>(
14873 bsl::allocator_arg,
14874 alloc,
14876 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14877 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14878 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
14879 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
14880 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
14881 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
14882 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
14883 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
14884 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
14885 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
14886}
14887#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 10
14888
14889#else
14890// The generated code below is a workaround for the absence of perfect
14891// forwarding in some compilers.
14892template <class t_TYPE, class... t_ARGS>
14894 bsl::allocator_arg_t,
14895 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14896 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
14897{
14898 return bsl::optional<t_TYPE>(
14899 bsl::allocator_arg,
14900 alloc,
14902 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
14903}
14904// }}} END GENERATED CODE
14905#endif
14906
14907#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
14908// {{{ BEGIN GENERATED CODE
14909// Command line: sim_cpp11_features.pl bslstl_optional.h
14910#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
14911#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
14912#endif
14913#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_V
14914#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_V BSLSTL_OPTIONAL_VARIADIC_LIMIT
14915#endif
14916# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS) && \
14917 !(defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900)
14918#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 0
14919template <class t_TYPE, class t_INIT_LIST_TYPE>
14921 bsl::allocator_arg_t,
14922 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14923 std::initializer_list<t_INIT_LIST_TYPE> il)
14924{
14925 return bsl::optional<t_TYPE>(
14926 bsl::allocator_arg,
14927 alloc,
14929 il);
14930}
14931#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 0
14932
14933#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 1
14934template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01>
14936 bsl::allocator_arg_t,
14937 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14938 std::initializer_list<t_INIT_LIST_TYPE> il,
14939 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
14940{
14941 return bsl::optional<t_TYPE>(
14942 bsl::allocator_arg,
14943 alloc,
14945 il,
14946 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
14947}
14948#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 1
14949
14950#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 2
14951template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
14952 class t_ARGS_02>
14954 bsl::allocator_arg_t,
14955 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14956 std::initializer_list<t_INIT_LIST_TYPE> il,
14957 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14958 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
14959{
14960 return bsl::optional<t_TYPE>(
14961 bsl::allocator_arg,
14962 alloc,
14964 il,
14965 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14966 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
14967}
14968#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 2
14969
14970#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 3
14971template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
14972 class t_ARGS_02,
14973 class t_ARGS_03>
14975 bsl::allocator_arg_t,
14976 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
14977 std::initializer_list<t_INIT_LIST_TYPE> il,
14978 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
14979 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
14980 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
14981{
14982 return bsl::optional<t_TYPE>(
14983 bsl::allocator_arg,
14984 alloc,
14986 il,
14987 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
14988 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
14989 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
14990}
14991#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 3
14992
14993#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 4
14994template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
14995 class t_ARGS_02,
14996 class t_ARGS_03,
14997 class t_ARGS_04>
14999 bsl::allocator_arg_t,
15000 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
15001 std::initializer_list<t_INIT_LIST_TYPE> il,
15002 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15003 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15004 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15005 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
15006{
15007 return bsl::optional<t_TYPE>(
15008 bsl::allocator_arg,
15009 alloc,
15011 il,
15012 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15013 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15014 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15015 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
15016}
15017#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 4
15018
15019#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 5
15020template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15021 class t_ARGS_02,
15022 class t_ARGS_03,
15023 class t_ARGS_04,
15024 class t_ARGS_05>
15026 bsl::allocator_arg_t,
15027 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
15028 std::initializer_list<t_INIT_LIST_TYPE> il,
15029 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15030 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15031 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15032 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15033 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
15034{
15035 return bsl::optional<t_TYPE>(
15036 bsl::allocator_arg,
15037 alloc,
15039 il,
15040 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15041 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15042 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15043 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15044 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
15045}
15046#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 5
15047
15048#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 6
15049template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15050 class t_ARGS_02,
15051 class t_ARGS_03,
15052 class t_ARGS_04,
15053 class t_ARGS_05,
15054 class t_ARGS_06>
15056 bsl::allocator_arg_t,
15057 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
15058 std::initializer_list<t_INIT_LIST_TYPE> il,
15059 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15060 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15061 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15062 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15063 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15064 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
15065{
15066 return bsl::optional<t_TYPE>(
15067 bsl::allocator_arg,
15068 alloc,
15070 il,
15071 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15072 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15073 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15074 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15075 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15076 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
15077}
15078#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 6
15079
15080#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 7
15081template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15082 class t_ARGS_02,
15083 class t_ARGS_03,
15084 class t_ARGS_04,
15085 class t_ARGS_05,
15086 class t_ARGS_06,
15087 class t_ARGS_07>
15089 bsl::allocator_arg_t,
15090 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
15091 std::initializer_list<t_INIT_LIST_TYPE> il,
15092 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15093 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15094 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15095 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15096 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15097 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15098 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
15099{
15100 return bsl::optional<t_TYPE>(
15101 bsl::allocator_arg,
15102 alloc,
15104 il,
15105 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15106 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15107 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15108 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15109 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15110 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15111 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
15112}
15113#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 7
15114
15115#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 8
15116template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15117 class t_ARGS_02,
15118 class t_ARGS_03,
15119 class t_ARGS_04,
15120 class t_ARGS_05,
15121 class t_ARGS_06,
15122 class t_ARGS_07,
15123 class t_ARGS_08>
15125 bsl::allocator_arg_t,
15126 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
15127 std::initializer_list<t_INIT_LIST_TYPE> il,
15128 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15129 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15130 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15131 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15132 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15133 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15134 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15135 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
15136{
15137 return bsl::optional<t_TYPE>(
15138 bsl::allocator_arg,
15139 alloc,
15141 il,
15142 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15143 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15144 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15145 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15146 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15147 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15148 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15149 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
15150}
15151#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 8
15152
15153#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 9
15154template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15155 class t_ARGS_02,
15156 class t_ARGS_03,
15157 class t_ARGS_04,
15158 class t_ARGS_05,
15159 class t_ARGS_06,
15160 class t_ARGS_07,
15161 class t_ARGS_08,
15162 class t_ARGS_09>
15164 bsl::allocator_arg_t,
15165 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
15166 std::initializer_list<t_INIT_LIST_TYPE> il,
15167 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15168 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15169 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15170 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15171 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15172 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15173 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15174 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
15175 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
15176{
15177 return bsl::optional<t_TYPE>(
15178 bsl::allocator_arg,
15179 alloc,
15181 il,
15182 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15183 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15184 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15185 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15186 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15187 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15188 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15189 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
15190 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
15191}
15192#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 9
15193
15194#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 10
15195template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15196 class t_ARGS_02,
15197 class t_ARGS_03,
15198 class t_ARGS_04,
15199 class t_ARGS_05,
15200 class t_ARGS_06,
15201 class t_ARGS_07,
15202 class t_ARGS_08,
15203 class t_ARGS_09,
15204 class t_ARGS_10>
15206 bsl::allocator_arg_t,
15207 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
15208 std::initializer_list<t_INIT_LIST_TYPE> il,
15209 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15210 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15211 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15212 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15213 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15214 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15215 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15216 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
15217 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
15218 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
15219{
15220 return bsl::optional<t_TYPE>(
15221 bsl::allocator_arg,
15222 alloc,
15224 il,
15225 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15226 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15227 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15228 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15229 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15230 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15231 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15232 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
15233 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
15234 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
15235}
15236#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 10
15237
15238# endif
15239#else
15240// The generated code below is a workaround for the absence of perfect
15241// forwarding in some compilers.
15242# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS) && \
15243 !(defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900)
15244template <class t_TYPE, class t_INIT_LIST_TYPE, class... t_ARGS>
15246 bsl::allocator_arg_t,
15247 typename bsl::optional<t_TYPE>::allocator_type const& alloc,
15248 std::initializer_list<t_INIT_LIST_TYPE> il,
15249 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
15250{
15251 return bsl::optional<t_TYPE>(
15252 bsl::allocator_arg,
15253 alloc,
15255 il,
15256 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
15257}
15258# endif
15259// }}} END GENERATED CODE
15260#endif
15261
15262template <class t_TYPE>
15265{
15267 BSLS_COMPILERFEATURES_FORWARD(t_TYPE, rhs));
15268}
15269
15270template <class t_TYPE>
15272{
15274}
15275
15276#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
15277// {{{ BEGIN GENERATED CODE
15278// Command line: sim_cpp11_features.pl bslstl_optional.h
15279#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
15280#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
15281#endif
15282#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_W
15283#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_W BSLSTL_OPTIONAL_VARIADIC_LIMIT
15284#endif
15285#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0
15286template <class t_TYPE, class t_ARG>
15289{
15290 return bsl::optional<t_TYPE>(
15292 BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg));
15293}
15294#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0
15295
15296#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1
15297template <class t_TYPE, class t_ARG, class t_ARGS_01>
15300 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
15301{
15302 return bsl::optional<t_TYPE>(
15305 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
15306}
15307#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1
15308
15309#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2
15310template <class t_TYPE, class t_ARG, class t_ARGS_01,
15311 class t_ARGS_02>
15314 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15315 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
15316{
15317 return bsl::optional<t_TYPE>(
15320 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15321 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
15322}
15323#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2
15324
15325#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3
15326template <class t_TYPE, class t_ARG, class t_ARGS_01,
15327 class t_ARGS_02,
15328 class t_ARGS_03>
15331 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15332 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15333 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
15334{
15335 return bsl::optional<t_TYPE>(
15338 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15339 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15340 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
15341}
15342#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3
15343
15344#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4
15345template <class t_TYPE, class t_ARG, class t_ARGS_01,
15346 class t_ARGS_02,
15347 class t_ARGS_03,
15348 class t_ARGS_04>
15351 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15352 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15353 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15354 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
15355{
15356 return bsl::optional<t_TYPE>(
15359 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15360 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15361 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15362 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
15363}
15364#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4
15365
15366#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5
15367template <class t_TYPE, class t_ARG, class t_ARGS_01,
15368 class t_ARGS_02,
15369 class t_ARGS_03,
15370 class t_ARGS_04,
15371 class t_ARGS_05>
15374 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15375 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15376 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15377 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15378 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
15379{
15380 return bsl::optional<t_TYPE>(
15383 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15384 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15385 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15386 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15387 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
15388}
15389#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5
15390
15391#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6
15392template <class t_TYPE, class t_ARG, class t_ARGS_01,
15393 class t_ARGS_02,
15394 class t_ARGS_03,
15395 class t_ARGS_04,
15396 class t_ARGS_05,
15397 class t_ARGS_06>
15400 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15401 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15402 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15403 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15404 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15405 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
15406{
15407 return bsl::optional<t_TYPE>(
15410 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15411 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15412 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15413 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15414 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15415 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
15416}
15417#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6
15418
15419#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7
15420template <class t_TYPE, class t_ARG, class t_ARGS_01,
15421 class t_ARGS_02,
15422 class t_ARGS_03,
15423 class t_ARGS_04,
15424 class t_ARGS_05,
15425 class t_ARGS_06,
15426 class t_ARGS_07>
15429 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15430 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15431 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15432 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15433 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15434 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15435 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
15436{
15437 return bsl::optional<t_TYPE>(
15440 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15441 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15442 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15443 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15444 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15445 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15446 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
15447}
15448#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7
15449
15450#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8
15451template <class t_TYPE, class t_ARG, class t_ARGS_01,
15452 class t_ARGS_02,
15453 class t_ARGS_03,
15454 class t_ARGS_04,
15455 class t_ARGS_05,
15456 class t_ARGS_06,
15457 class t_ARGS_07,
15458 class t_ARGS_08>
15461 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15462 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15463 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15464 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15465 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15466 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15467 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15468 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
15469{
15470 return bsl::optional<t_TYPE>(
15473 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15474 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15475 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15476 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15477 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15478 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15479 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15480 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
15481}
15482#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8
15483
15484#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9
15485template <class t_TYPE, class t_ARG, class t_ARGS_01,
15486 class t_ARGS_02,
15487 class t_ARGS_03,
15488 class t_ARGS_04,
15489 class t_ARGS_05,
15490 class t_ARGS_06,
15491 class t_ARGS_07,
15492 class t_ARGS_08,
15493 class t_ARGS_09>
15496 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15497 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15498 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15499 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15500 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15501 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15502 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15503 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
15504 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
15505{
15506 return bsl::optional<t_TYPE>(
15509 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15510 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15511 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15512 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15513 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15514 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15515 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15516 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
15517 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
15518}
15519#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9
15520
15521#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10
15522template <class t_TYPE, class t_ARG, class t_ARGS_01,
15523 class t_ARGS_02,
15524 class t_ARGS_03,
15525 class t_ARGS_04,
15526 class t_ARGS_05,
15527 class t_ARGS_06,
15528 class t_ARGS_07,
15529 class t_ARGS_08,
15530 class t_ARGS_09,
15531 class t_ARGS_10>
15534 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15535 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15536 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15537 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15538 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15539 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15540 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15541 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
15542 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
15543 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
15544{
15545 return bsl::optional<t_TYPE>(
15548 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15549 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15550 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15551 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15552 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15553 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15554 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15555 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
15556 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
15557 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
15558}
15559#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10
15560
15561
15562# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS) && \
15563 !(defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900)
15564#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0
15565template <class t_TYPE, class t_INIT_LIST_TYPE>
15567 std::initializer_list<t_INIT_LIST_TYPE> il)
15568{
15569 return bsl::optional<t_TYPE>(
15571 il);
15572}
15573#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0
15574
15575#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1
15576template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01>
15578 std::initializer_list<t_INIT_LIST_TYPE> il,
15579 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
15580{
15581 return bsl::optional<t_TYPE>(
15583 il,
15584 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
15585}
15586#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1
15587
15588#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2
15589template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15590 class t_ARGS_02>
15592 std::initializer_list<t_INIT_LIST_TYPE> il,
15593 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15594 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
15595{
15596 return bsl::optional<t_TYPE>(
15598 il,
15599 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15600 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
15601}
15602#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2
15603
15604#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3
15605template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15606 class t_ARGS_02,
15607 class t_ARGS_03>
15609 std::initializer_list<t_INIT_LIST_TYPE> il,
15610 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15611 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15612 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
15613{
15614 return bsl::optional<t_TYPE>(
15616 il,
15617 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15618 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15619 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
15620}
15621#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3
15622
15623#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4
15624template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15625 class t_ARGS_02,
15626 class t_ARGS_03,
15627 class t_ARGS_04>
15629 std::initializer_list<t_INIT_LIST_TYPE> il,
15630 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15631 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15632 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15633 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
15634{
15635 return bsl::optional<t_TYPE>(
15637 il,
15638 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15639 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15640 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15641 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
15642}
15643#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4
15644
15645#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5
15646template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15647 class t_ARGS_02,
15648 class t_ARGS_03,
15649 class t_ARGS_04,
15650 class t_ARGS_05>
15652 std::initializer_list<t_INIT_LIST_TYPE> il,
15653 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15654 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15655 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15656 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15657 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
15658{
15659 return bsl::optional<t_TYPE>(
15661 il,
15662 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15663 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15664 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15665 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15666 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
15667}
15668#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5
15669
15670#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6
15671template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15672 class t_ARGS_02,
15673 class t_ARGS_03,
15674 class t_ARGS_04,
15675 class t_ARGS_05,
15676 class t_ARGS_06>
15678 std::initializer_list<t_INIT_LIST_TYPE> il,
15679 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15680 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15681 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15682 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15683 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15684 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
15685{
15686 return bsl::optional<t_TYPE>(
15688 il,
15689 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15690 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15691 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15692 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15693 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15694 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
15695}
15696#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6
15697
15698#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7
15699template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15700 class t_ARGS_02,
15701 class t_ARGS_03,
15702 class t_ARGS_04,
15703 class t_ARGS_05,
15704 class t_ARGS_06,
15705 class t_ARGS_07>
15707 std::initializer_list<t_INIT_LIST_TYPE> il,
15708 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15709 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15710 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15711 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15712 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15713 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15714 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
15715{
15716 return bsl::optional<t_TYPE>(
15718 il,
15719 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15720 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15721 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15722 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15723 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15724 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15725 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
15726}
15727#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7
15728
15729#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8
15730template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15731 class t_ARGS_02,
15732 class t_ARGS_03,
15733 class t_ARGS_04,
15734 class t_ARGS_05,
15735 class t_ARGS_06,
15736 class t_ARGS_07,
15737 class t_ARGS_08>
15739 std::initializer_list<t_INIT_LIST_TYPE> il,
15740 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15741 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15742 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15743 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15744 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15745 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15746 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15747 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
15748{
15749 return bsl::optional<t_TYPE>(
15751 il,
15752 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15753 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15754 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15755 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15756 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15757 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15758 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15759 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
15760}
15761#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8
15762
15763#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9
15764template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15765 class t_ARGS_02,
15766 class t_ARGS_03,
15767 class t_ARGS_04,
15768 class t_ARGS_05,
15769 class t_ARGS_06,
15770 class t_ARGS_07,
15771 class t_ARGS_08,
15772 class t_ARGS_09>
15774 std::initializer_list<t_INIT_LIST_TYPE> il,
15775 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15776 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15777 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15778 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15779 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15780 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15781 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15782 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
15783 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
15784{
15785 return bsl::optional<t_TYPE>(
15787 il,
15788 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15789 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15790 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15791 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15792 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15793 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15794 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15795 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
15796 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
15797}
15798#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9
15799
15800#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10
15801template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
15802 class t_ARGS_02,
15803 class t_ARGS_03,
15804 class t_ARGS_04,
15805 class t_ARGS_05,
15806 class t_ARGS_06,
15807 class t_ARGS_07,
15808 class t_ARGS_08,
15809 class t_ARGS_09,
15810 class t_ARGS_10>
15812 std::initializer_list<t_INIT_LIST_TYPE> il,
15813 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
15814 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
15815 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
15816 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
15817 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
15818 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
15819 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
15820 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
15821 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
15822 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
15823{
15824 return bsl::optional<t_TYPE>(
15826 il,
15827 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
15828 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
15829 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
15830 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
15831 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
15832 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
15833 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
15834 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
15835 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
15836 BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
15837}
15838#endif // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10
15839
15840# endif
15841#else
15842// The generated code below is a workaround for the absence of perfect
15843// forwarding in some compilers.
15844template <class t_TYPE, class t_ARG, class... t_ARGS>
15847 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
15848{
15849 return bsl::optional<t_TYPE>(
15852 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
15853}
15854
15855# if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS) && \
15856 !(defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900)
15857template <class t_TYPE, class t_INIT_LIST_TYPE, class... t_ARGS>
15859 std::initializer_list<t_INIT_LIST_TYPE> il,
15860 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
15861{
15862 return bsl::optional<t_TYPE>(
15864 il,
15865 BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
15866}
15867# endif
15868// }}} END GENERATED CODE
15869#endif
15870} // close namespace bsl
15871
15872// There is a problem in the standard definition of the is-optional concept
15873// that results in types inheriting from std::optional not being identified
15874// correctly as optional types. The end result is endless recursion evaluating
15875// the requires clause for the spaceship operator when it is implemented
15876// according to the C++20 specification, which currently happens for GCC 11-13
15877// and MSVC-2022 prior to MSVC 19.36 when building with C++20. In MSVC 19.36
15878// Microsoft implemented the solution suggested in LWG-3746, so the workaround
15879// is not required for that and subsequent versions.
15880//
15881// The issue with the standard is tracked here:
15882// https://cplusplus.github.io/LWG/lwg-active.html#3746
15883//
15884// See DRQS 170388558 for more information
15885//
15886// BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_GNU_WORKAROUND_NEEDED and
15887// BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_MSVC_WORKAROUND_NEEDED are deliberately
15888// exposed to allow their use in higher level optional types (i.e.,
15889// bdlb::NullableValue).
15890
15891// The following hacks prevent compiler crashes, and should only be applied on
15892// compiler versions where the problem is not fixed. The hacks required for
15893// gcc and for MSVC are different due to different standard library
15894// implementations, hence the two distinct macros and implementations.
15895
15896# if BSLS_COMPILERFEATURES_CPLUSPLUS==202002L && \
15897 defined(BSLS_LIBRARYFEATURES_STDCPP_GNU) && \
15898 (11 <= _GLIBCXX_RELEASE && _GLIBCXX_RELEASE < 14)
15899
15900#define BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_GNU_WORKAROUND_NEEDED
15901
15902namespace std {
15903template<typename _Tp>
15904inline constexpr bool __is_optional_v<bsl::optional<_Tp>> = true;
15905}
15906
15907# endif // BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_GNU_WORKAROUND_NEEDED
15908
15909# if BSLS_COMPILERFEATURES_CPLUSPLUS == 202002L && \
15910 defined(BSLS_PLATFORM_CMP_MSVC) && \
15911 (BSLS_PLATFORM_CMP_VERSION >= 1930 && BSLS_PLATFORM_CMP_VERSION < 1936)
15912 // This workaround is not required from MSVC 19.36 onwards.
15913
15914#define BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_MSVC_WORKAROUND_NEEDED
15915
15916namespace std {
15917template <typename _Tp>
15918inline constexpr bool _Is_specialization_v<bsl::optional<_Tp>, std::optional> =
15919 true;
15920}
15921
15922# endif // BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_MSVC_WORKAROUND_NEEDED
15923
15924#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL
15925#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL
15926#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL
15927#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL
15928#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR
15929#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR
15930#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR
15931#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR
15932#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM
15933#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM
15934#undef BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL
15935#undef BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT
15936#undef BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT
15937#undef BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT
15938#undef BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT
15939#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL
15940#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL
15941#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED
15942#undef BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG
15943#undef BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG
15944#undef BSLSTL_OPTIONAL_REQUIRES
15945
15946#else // if ! defined(DEFINED_BSLSTL_OPTIONAL_H)
15947# error Not valid except when included from bslstl_optional.h
15948#endif // ! defined(COMPILING_BSLSTL_OPTIONAL_H)
15949
15950#endif // ! defined(INCLUDED_BSLSTL_OPTIONAL_CPP03)
15951
15952// ----------------------------------------------------------------------------
15953// Copyright 2020 Bloomberg Finance L.P.
15954//
15955// Licensed under the Apache License, Version 2.0 (the "License");
15956// you may not use this file except in compliance with the License.
15957// You may obtain a copy of the License at
15958//
15959// http://www.apache.org/licenses/LICENSE-2.0
15960//
15961// Unless required by applicable law or agreed to in writing, software
15962// distributed under the License is distributed on an "AS IS" BASIS,
15963// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15964// See the License for the specific language governing permissions and
15965// limitations under the License.
15966// ----------------------------- END-OF-FILE ----------------------------------
15967
15968/** @} */
15969/** @} */
15970/** @} */
#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:580
decay_imp< U, k_ISARRAY, k_ISFUNC >::type type
Definition bslmf_decay.h:166
Definition bslstl_optional.h:1861
optional() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:4630
optional & operator=(bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:5031
Definition bslma_allocator.h:457
Optional_Base()
Definition bslstl_optional.h:3125
t_TYPE & emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
Definition bslstl_optional.h:3457
Optional_Base & operator=(const Optional_Base &rhs)
Definition bslstl_optional.h:3583
void assignOrEmplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) rhs)
Definition bslstl_optional.h:3421
t_TYPE & dereferenceRaw()
Definition bslstl_optional.h:3433
allocator_type AllocType
Definition bslstl_optional.h:818
bool has_value() const BSLS_KEYWORD_NOEXCEPT
Return false if this object is disengaged, and true otherwise.
Definition bslstl_optional.h:3675
t_TYPE value_or(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const
Definition bslstl_optional.h:3755
void swap(Optional_Base &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl t_TYPE & value()
Definition bslstl_optional.h:1158
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Return allocator used for construction of value_type.
Definition bslstl_optional.h:3666
t_TYPE & operator*()
Definition bslstl_optional.h:3652
void reset() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:3480
t_TYPE value_type
Definition bslstl_optional.h:812
bsl::allocator< char > allocator_type
Definition bslstl_optional.h:814
t_TYPE * operator->()
Definition bslstl_optional.h:3623
#define BSLMF_MOVABLEREF_DEDUCE(...)
Definition bslmf_movableref.h:690
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_INVOKE_NORETURN(X)
Definition bsls_assert.h:1895
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#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:588
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:609
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:634
#define BSLS_UTIL_ADDRESSOF(OBJ)
Definition bsls_util.h:289
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:381
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:295
#define BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(DERIVED)
Definition bslstl_optional.h:351
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE, ANY_TYPE)
Definition bslstl_optional.h:321
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:389
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( TYPE, ANY_TYPE)
Definition bslstl_optional.h:327
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE)
Definition bslstl_optional.h:340
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:287
#define BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(U, V)
Definition bslstl_optional.h:371
#define BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(ARG)
Definition bslstl_optional.h:426
#define BSLSTL_OPTIONAL_REQUIRES(EXPR)
Definition bslstl_optional.h:442
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE)
Definition bslstl_optional.h:346
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:308
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(TYPE, ANY_TYPE)
Definition bslstl_optional.h:417
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE, ANY_TYPE)
Definition bslstl_optional.h:314
#define BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(DERIVED)
Definition bslstl_optional.h:357
#define BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(U, V)
Definition bslstl_optional.h:366
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)
Definition bslstl_optional.h:301
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_FORWARD_REF(TYPE, ANY_TYPE)
Definition bslstl_optional.h:406
#define BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(U, V)
Definition bslstl_optional.h:376
#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR( TYPE, ANY_TYPE)
Definition bslstl_optional.h:334
#define BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(U, V)
Definition bslstl_optional.h:361
#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED(TYPE, DERIVED)
Definition bslstl_optional.h:398
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
void hashAppend(HASH_ALGORITHM &hashAlg, const baljsn::EncoderTestAddress &object)
Definition baljsn_encoder_testtypes.h:9236
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)
bool operator<=(const Guid &lhs, const Guid &rhs)
bool operator>(const Guid &lhs, const Guid &rhs)
Decimal32 operator*(Decimal32 lhs, Decimal32 rhs)
Definition bdlb_printmethods.h:283
const nullopt_t nullopt
bool operator==(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator==(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator!=(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator!=(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator<(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator<(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator>(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator>(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator<=(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator<=(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator>=(const bsl::optional< t_LHS_TYPE > &lhs, const t_RHS_TYPE &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP bool operator>=(const t_LHS_TYPE &lhs, const bsl::optional< t_RHS_TYPE > &rhs) BSLSTL_OPTIONAL_REQUIRES(!BloombergLP BSLS_KEYWORD_CONSTEXPR 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)
Definition bslstl_optional.h:2881
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const array< TYPE, SIZE > &input)
Pass the specified input to the specified hashAlgorithm
Definition bslstl_array.h:950
const in_place_t in_place
Definition balxml_encoderoptions.h:68
Definition bslstl_algorithm.h:82
Definition bdldfp_decimal.h:5188
Definition bslmf_enableif.h:525
Definition bslstl_inplace.h:99
Definition bslmf_integralconstant.h:244
Definition bslmf_isnothrowmoveconstructible.h:358
Definition bslstl_optional.h:467
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:475
t_TYPE type
This typedef is an alias to the (template parameter) t_TYPE.
Definition bslmf_removeconst.h:161
Definition bslmf_isbitwisecopyable.h:298
t_TYPE & emplace(bslma::Allocator *allocator, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
Definition bslstl_optional.h:2989
Optional_DataImp() BSLS_KEYWORD_NOEXCEPT
Create an empty Optional_DataImp object.
Definition bslstl_optional.h:2979
bool hasValue() const BSLS_KEYWORD_NOEXCEPT
Return true if this objects has a value, and false otherwise.
Definition bslstl_optional.h:3066
t_TYPE & value()
Definition bslstl_optional.h:3054
void reset() BSLS_KEYWORD_NOEXCEPT
Destroy the value_type object in d_buffer, if any.
Definition bslstl_optional.h:3023
~Optional_Data()
Destroy the managed value_type object, if it exists.
Definition bslstl_optional.h:3109
Definition bslstl_optional.h:521
BSLS_KEYWORD_CONSTEXPR Optional_OptNoSuchType(int) BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:563
Definition bsls_objectbuffer.h:276
TYPE * address()
Definition bsls_objectbuffer.h:334
TYPE & object()
Definition bsls_objectbuffer.h:351