// bslstl_optional_cpp03.h                                            -*-C++-*-

// Automatically generated file.  **DO NOT EDIT**

#ifndef INCLUDED_BSLSTL_OPTIONAL_CPP03
#define INCLUDED_BSLSTL_OPTIONAL_CPP03

//@PURPOSE: Provide C++03 implementation for bslstl_optional.h
//
//@CLASSES: See bslstl_optional.h for list of classes
//
//@SEE_ALSO: bslstl_optional
//
//@DESCRIPTION:  This component is the C++03 translation of a C++11 component,
// generated by the 'sim_cpp11_features.pl' program.  If the original header
// contains any specially delimited regions of C++11 code, then this generated
// file contains the C++03 equivalent, i.e., with variadic templates expanded
// and rvalue-references replaced by 'bslmf::MovableRef' objects.  The header
// code in this file is designed to be '#include'd into the original header
// when compiling with a C++03 compiler.  If there are no specially delimited
// regions of C++11 code, then this header contains no code and is not
// '#include'd in the original header.
//
// Generated on Tue Apr 28 12:08:43 2026
// Command line: sim_cpp11_features.pl bslstl_optional.h

#ifdef COMPILING_BSLSTL_OPTIONAL_H

// ============================================================================
//                      Section: BSLSTL_OPTIONAL_* Macros
// ============================================================================

#if defined (BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY) && \
   !(defined(BSLS_LIBRARYFEATURES_FORCE_ABI_ENABLED) &&          \
    (BSLS_LIBRARYFEATURES_FORCE_ABI_ENABLED < 17))

/// The following macro `BSLSTL_OPTIONAL_USES_STD_ALIASES` controls whether
/// platform standard library is used as a basis for `bsl` types in the
/// following ways:
///  - `bsl::nullopt` is an alias to `std::nullopt`
///
///  - `bsl::optional<T>` inherits from `std::optional<T>` when `T` is not
///    allocator-aware.
///
/// This macro does *not* control whether there are conversions and comparisons
/// between `std::optional` and `bsl::optional`, that is conditioned only on
/// whether `std::optional` is available (i.e.,
/// `BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY` is defined).
# define BSLSTL_OPTIONAL_USES_STD_ALIASES

/// `BSLSTL_OPTIONAL_CONSTEXPR17` controls whether constructors that are
/// `constexpr` in C++17 `std::optional` are `constexpr` in `bsl::optional`
/// for allocator-unaware types.
# define BSLSTL_OPTIONAL_CONSTEXPR17 constexpr

/// `BSLSTL_OPTIONAL_CONSTEXPR20` controls whether constructors that are
/// `constexpr` in C++20 `std::optional` are `constexpr` in `bsl::optional`
/// for allocator-unaware types.
# ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_BASELINE_LIBRARY
#  define BSLSTL_OPTIONAL_CONSTEXPR20 BSLS_KEYWORD_CONSTEXPR_CPP20
# else
#  define BSLSTL_OPTIONAL_CONSTEXPR20
# endif
#else
# define BSLSTL_OPTIONAL_CONSTEXPR17
# define BSLSTL_OPTIONAL_CONSTEXPR20
#endif  // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY & not disabled

# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY

// This macro is defined as 'std::is_constructible<U, V>::value' in C++11 and
// later, and as 'DEFAULT' in C++03 with the value of 'DEFAULT' typically
// chosen to not affect the constraint this macro appears in.  Note that
// 'is_constructible', unlike 'is_convertible', is 'true' for both implicitly
// and explicitly constructible conversions.
#define BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(U, V, DEFAULT)                     \
    std::is_constructible<U, V>::value

// This macro is defined as 'std::is_assignable<U, V>::value' in C++11 and
// later, and as 'DEFAULT' in C++03 with the value of 'DEFAULT' typically
// chosen to not affect the constraint this macro appears in.
#define BSLSTL_OPTIONAL_IS_ASSIGNABLE(U, V, DEFAULT)                        \
    std::is_assignable<U, V>::value

# else  // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY

#define BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(U, V, DEFAULT) DEFAULT

#define BSLSTL_OPTIONAL_IS_ASSIGNABLE(U, V, DEFAULT) DEFAULT

# endif  // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY else

// As in 'std' implementation, if the 'TYPE' converts from any value category
// of an optional type 'OPT_TYPE', we consider it convertible from that
// optional type.
#define BSLSTL_OPTIONAL_CONVERTS_FROM(TYPE, OPT_TYPE)                         \
    (bsl::is_convertible<const OPT_TYPE&, TYPE>::value ||                     \
     bsl::is_convertible<OPT_TYPE&, TYPE>::value ||                           \
     bsl::is_convertible<const OPT_TYPE, TYPE>::value ||                      \
     bsl::is_convertible<OPT_TYPE, TYPE>::value ||                            \
     BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, const OPT_TYPE&, false) ||      \
     BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, OPT_TYPE&, false) ||            \
     BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, const OPT_TYPE, false) ||       \
     BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, OPT_TYPE, false))

// As in 'std' implementation, if the 'TYPE' can be assigned to from any value
// category of an optional type 'OPT_TYPE', we consider it convertible from
// that optional type.
# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
#define BSLSTL_OPTIONAL_ASSIGNS_FROM(TYPE, OPT_TYPE)                          \
    (std::is_assignable<TYPE&, const OPT_TYPE&>::value ||                     \
     std::is_assignable<TYPE&, OPT_TYPE&>::value ||                           \
     std::is_assignable<TYPE&, const OPT_TYPE>::value ||                      \
     std::is_assignable<TYPE&, OPT_TYPE>::value)

# else  // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
// The value of this macro is chosen so it does not affect the disjunction-form
// constraint this macro appears in.
#define BSLSTL_OPTIONAL_ASSIGNS_FROM(TYPE, OPT_TYPE) false
# endif  // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY else

#define BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)            \
    BSLSTL_OPTIONAL_CONVERTS_FROM(                                            \
        TYPE,                                                                 \
        bsl::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)

#define BSLSTL_OPTIONAL_ASSIGNS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)             \
    BSLSTL_OPTIONAL_ASSIGNS_FROM(                                             \
        TYPE,                                                                 \
        bsl::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
#define BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)            \
    BSLSTL_OPTIONAL_CONVERTS_FROM(                                            \
        TYPE,                                                                 \
        std::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)

#define BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)             \
    BSLSTL_OPTIONAL_ASSIGNS_FROM(                                             \
        TYPE,                                                                 \
        std::optional<typename bsl::remove_cvref<ANY_TYPE>::type>)
# else  // BSLSTL_OPTIONAL_USES_STD_ALIASES
// The value of these macros is chosen to not affect the constraints these
// macros appears in.
#define BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) false
#define BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) false

# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES else

// Macros to define common constraints that enable a constructor or assignment
// operator.
#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE,          \
                                                               ANY_TYPE)      \
    typename bsl::enable_if<                                                  \
        !bsl::is_same<TYPE, ANY_TYPE>::value &&                               \
        !BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) &&        \
            BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true),           \
        BloombergLP::bslstl::Optional_OptNoSuchType>::type

#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(TYPE,         \
                                                                ANY_TYPE)     \
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(                   \
                     TYPE,                                                    \
                     ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)

#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE,          \
                                                               ANY_TYPE)      \
    typename bsl::enable_if<                                                  \
        !BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) &&        \
            BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true),           \
        BloombergLP::bslstl::Optional_OptNoSuchType>::type

#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(TYPE,         \
                                                                ANY_TYPE)     \
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(                   \
                     TYPE,                                                    \
                     ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)

#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE,        \
                                                                 ANY_TYPE)    \
    typename bsl::enable_if<                                                  \
        BloombergLP::bslstl::Optional_PropagatesAllocator<TYPE,               \
                                                          ANY_TYPE>::value,   \
        BloombergLP::bslstl::Optional_OptNoSuchType>::type

#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(TYPE,       \
                                                                  ANY_TYPE)   \
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(                 \
                     TYPE,                                                    \
                     ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)

#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR(     \
    TYPE, ANY_TYPE)                                                           \
    typename bsl::enable_if<                                                  \
        !BloombergLP::bslstl::Optional_PropagatesAllocator<TYPE,              \
                                                           ANY_TYPE>::value,  \
        BloombergLP::bslstl::Optional_OptNoSuchType>::type

#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR(    \
    TYPE, ANY_TYPE)                                                           \
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR(         \
                     TYPE,                                                    \
                     ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)

#define BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE)             \
    typename bsl::enable_if<                                                  \
        BloombergLP::bslstl::Optional_ConstructsFromType<TYPE,                \
                                                         ANY_TYPE>::value,    \
        BloombergLP::bslstl::Optional_OptNoSuchType>::type

#define BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(TYPE, ANY_TYPE)            \
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(                                \
                     TYPE,                                                    \
                     ANY_TYPE) = BloombergLP::bslstl::Optional_OptNoSuchType(0)

#define BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(DERIVED)              \
    typename bsl::enable_if<                                                  \
        BloombergLP::bslmf::IsAccessibleBaseOf<optional, DERIVED>::value &&   \
        !bsl::is_const<DERIVED>::value,                                       \
        BloombergLP::bslstl::Optional_OptNoSuchType>::type

#define BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(DERIVED)             \
    BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(DERIVED) =                \
                                 BloombergLP::bslstl::Optional_OptNoSuchType(0)

#define BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(U, V)                    \
    typename bsl::enable_if<                                                  \
        !bsl::is_convertible<V, U>::value,                                    \
        BloombergLP::bslstl::Optional_OptNoSuchType>::type

#define BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(U, V)                   \
    BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(                             \
                            U,                                                \
                            V) = BloombergLP::bslstl::Optional_OptNoSuchType(0)

#define BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(U, V)                \
    typename bsl::enable_if<                                                  \
        bsl::is_convertible<V, U>::value,                                     \
        BloombergLP::bslstl::Optional_OptNoSuchType>::type

#define BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(U, V)               \
    BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(                         \
                            U,                                                \
                            V) = BloombergLP::bslstl::Optional_OptNoSuchType(0)

#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE)       \
    typename bsl::enable_if<                                                  \
        !BSLSTL_OPTIONAL_CONVERTS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE) &&        \
            BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true) &&         \
            BSLSTL_OPTIONAL_IS_ASSIGNABLE(TYPE&, ANY_TYPE, true) &&           \
            !BSLSTL_OPTIONAL_ASSIGNS_FROM_BSL_OPTIONAL(TYPE, ANY_TYPE),       \
        optional<TYPE> >::type

#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(TYPE, ANY_TYPE)       \
    typename bsl::enable_if<                                                  \
        !BSLSTL_OPTIONAL_CONVERTS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE) &&        \
            BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(TYPE, ANY_TYPE, true) &&         \
            BSLSTL_OPTIONAL_IS_ASSIGNABLE(TYPE&, ANY_TYPE, true) &&           \
            !BSLSTL_OPTIONAL_ASSIGNS_FROM_STD_OPTIONAL(TYPE, ANY_TYPE),       \
        optional<TYPE> >::type

# if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
#   define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED(TYPE, DERIVED)          \
      typename bsl::enable_if<                                                \
        BloombergLP::bslmf::IsAccessibleBaseOf<bsl::optional<TYPE>,           \
                                               DERIVED>::value &&             \
        !bsl::is_same<bsl::optional<TYPE>, DERIVED>::value,                   \
        optional<TYPE> >::type
# endif

#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_FORWARD_REF(TYPE, ANY_TYPE)        \
    typename bsl::enable_if<                                                  \
        !bsl::is_same<bsl::optional<TYPE>,                                    \
                      typename bsl::remove_cvref<ANY_TYPE>::type>::value &&   \
            !(bsl::is_same<TYPE,                                              \
                           typename bsl::decay<ANY_TYPE>::type>::value &&     \
              std::is_scalar<TYPE>::value) &&                                 \
            std::is_constructible<TYPE, ANY_TYPE>::value &&                   \
            std::is_assignable<TYPE, ANY_TYPE>::value,                        \
        optional<TYPE> >::type

#define BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(TYPE, ANY_TYPE)           \
    typename bsl::enable_if<                                                  \
        !::BloombergLP::bslmf::IsAccessibleBaseOf<                            \
            bsl::optional<TYPE>,                                              \
            typename bsl::remove_cv<                                          \
                typename ::BloombergLP::bslmf::MovableRefUtil::               \
                    RemoveReference<ANY_TYPE>::type>::type>::value,           \
        optional<TYPE> >::type

#define BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(ARG)                      \
    typename bsl::enable_if<                                                  \
        !bsl::is_same<                                                        \
            typename bsl::remove_cvref<ARG>::type,                            \
            bsl::allocator_arg_t>::value,                                     \
        optional<t_TYPE> >::type

#ifdef BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS
  #define BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(ARG) = ARG
#else
  #define BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(ARG)
#endif

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
  #define BSLSTL_OPTIONAL_REQUIRES(EXPR) requires(EXPR)
#else
  #define BSLSTL_OPTIONAL_REQUIRES(EXPR)
#endif

namespace BloombergLP {
namespace bslstl {
/// This trivial tag type is used to create `nullopt_t` objects prior to
/// C++17.
struct Optional_NulloptConstructToken {
};
}  // close package namespace
}  // close enterprise namespace

namespace bsl {

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES

using nullopt_t = std::nullopt_t;
using std::nullopt;

# else  // BSLSTL_OPTIONAL_USES_STD_ALIASES

                              // ================
                              // struct nullopt_t
                              // ================

/// This trivial tag type is used to create `optional` objects in a disengaged
/// state.  It uses a constructor template to avoid being constructible from
/// any braced list.  See implementation notes for more information.
struct nullopt_t {

    // CREATORS

    /// Create a `nullopt_t` object.  Note that the argument is not used.
    template <class t_TYPE>
    explicit 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
    {
    }
};

/// Value of type `nullopt_t` used as an argument to functions that take a
/// `nullopt_t` argument.
#  if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES)
inline constexpr
nullopt_t nullopt(BloombergLP::bslstl::Optional_NulloptConstructToken{});
#  else
extern const nullopt_t nullopt;
#  endif

# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

template <class t_TYPE>
class optional;

}  // close namespace bsl

// ============================================================================
//                Section: bslstl::Optional_* Utility Classes
// ============================================================================

namespace BloombergLP {
namespace bslstl {

                // =============================
                // struct Optional_IsBslOptional
                // =============================

template <class t_TYPE>
struct Optional_IsBslOptional : bsl::false_type {
};

template <class t_TYPE>
struct Optional_IsBslOptional<bsl::optional<t_TYPE> > : bsl::true_type {
};

                // =======================================
                // struct Optional_IsTriviallyDestructible
                // =======================================

# ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY

/// This metafunction is derived from
/// `std::is_trivially_destructible<t_TYPE>` in C++11 and later.  In C++03,
/// the metafunction is derived from `bsl::is_trivially_copyable`, a trait
/// that implies the type is also trivially destructible.
template <class t_TYPE>
struct Optional_IsTriviallyDestructible
: std::is_trivially_destructible<t_TYPE> {
};

# else  // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY

/// C++03 does not provide a trivially destructible trait.  Instead we use
/// `bslmf::IsBitwiseCopyable` which implies the type is also trivially
/// destructible.
///
/// Note that we use `bslmf::IsBitwiseCopyable` here and not
/// `bsl::is_trivially_copyable` because on some platforms, the native
/// `std::is_trivially_copyable<Optional_Data<t_TYPE, true>>` is `false` even
/// though it has no dtor and `TYPE` is trivally copyable.
template <class t_TYPE>
struct Optional_IsTriviallyDestructible : bslmf::IsBitwiseCopyable<t_TYPE> {
};

# endif  // BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY else

                        // ============================
                        // class Optional_OptNoSuchType
                        // ============================

/// This component-private trivial tag type is used to distinguish between
/// arguments passed by a user, and an `enable_if` argument.  It is not default
/// constructible so the following construction never invokes a constrained
/// single parameter constructor:
/// ```
///  optional<SomeType> o(int, {});
/// ```
struct Optional_OptNoSuchType {

    // CREATORS

    /// Create an `Optional_OptNoSuchType` object.  Note that the argument is
    /// not used.
    explicit BSLS_KEYWORD_CONSTEXPR Optional_OptNoSuchType(
                                                    int) BSLS_KEYWORD_NOEXCEPT;
};

// CREATORS
inline
BSLS_KEYWORD_CONSTEXPR Optional_OptNoSuchType::Optional_OptNoSuchType(
                                                     int) BSLS_KEYWORD_NOEXCEPT
{
}

                     // ==================================
                     // class Optional_PropagatesAllocator
                     // ==================================

/// This metafunction is derived from `bsl::true_type` if `t_TYPE` is an
/// allocator-aware const type, and if `t_ANY_TYPE` is the same as `t_TYPE`,
/// minus the cv qualification.  This trait is used to enable a constructor
/// overload for a const qualified allocator-aware `ValueType` taking an rvalue
/// of Optional_Base of the non-const qualified `ValueType`.  Such an overload
/// needs to propagate the allocator.
template <class t_TYPE, class t_ANY_TYPE>
struct Optional_PropagatesAllocator
: bsl::integral_constant<
      bool,
      bslma::UsesBslmaAllocator<t_TYPE>::value &&
          bsl::is_const<t_TYPE>::value &&
          bsl::is_same<t_ANY_TYPE,
                       typename bsl::remove_cv<t_TYPE>::type>::value> {
};

/// This metafunction is derived from `bsl::true_type` if `t_ANY_TYPE` is not
/// derived from `bsl::optional<t_TYPE>`, `t_ANY_TYPE` is not a tag type, and
/// `t_TYPE` is constructible from `t_ANY_TYPE`.
template <class t_TYPE, class t_ANY_TYPE>
struct Optional_ConstructsFromType
: bsl::integral_constant<
      bool,
      !bslmf::IsAccessibleBaseOf<
          bsl::optional<t_TYPE>,
          typename bsl::remove_cvref<t_ANY_TYPE>::type>::value &&
      !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
                    bsl::nullopt_t>::value &&
      !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
                    bsl::in_place_t>::value &&
      !bsl::is_same<typename bsl::remove_cvref<t_ANY_TYPE>::type,
                    bsl::allocator_arg_t>::value &&
      BSLSTL_OPTIONAL_IS_CONSTRUCTIBLE(t_TYPE, t_ANY_TYPE, true)> {
};

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
                     // ===============================
                     // struct Optional_ImmovableHelper
                     // ===============================

/// This struct is used to implement direct initialization of the private data
/// member of the `std::optional` class, which makes it possible to support
/// immovable types returned from the `transform` member function.
template <class t_TYPE, class t_INVOCABLE, class t_ARG>
struct Optional_ImmovableHelper {
    t_INVOCABLE&& invocable;
    t_ARG&&       arg;

    operator t_TYPE()
    {
        return std::invoke(std::forward<t_INVOCABLE>(invocable),
                           std::forward<t_ARG>(arg));
    }
};
#endif

                        // ===========================
                        // Component-Private Tag Types
                        // ===========================

// The types defined in this section are used to select particular templated
// constructors of 'class Optional_Base'.  This avoids the need to duplicate
// constraints between 'optional' and 'Optional_Base'.

struct Optional_ConstructFromForwardRef {};
struct Optional_CopyConstructFromOtherOptional {};
struct Optional_MoveConstructFromOtherOptional {};
struct Optional_CopyConstructFromStdOptional {};
struct Optional_MoveConstructFromStdOptional {};

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
/// Constructor tag used to implement the `transform` function.
struct Optional_InvokeConstructorTag {
    explicit Optional_InvokeConstructorTag() = default;
};
#endif

                           // ======================
                           // class Optional_DataImp
                           // ======================

/// This component-private `struct` manages a `value_type` object in an
/// `Optional_Base` object.  This class provides an abstraction for `const`
/// value type.  An `Optional_Base` object may contain an object of `const`
/// type.  An assignment to such an `Optional_Base` object should not succeed.
/// However, unless the `Optional_Base` object itself is `const`, it should be
/// possible to change the value of the `Optional_Base` object using `emplace`.
/// In order to allow for that, this class manages a non-const object of
/// `value_type`, but all the accessors return a `const` adjusted reference to
/// the managed object.
template <class t_TYPE>
struct Optional_DataImp {

  private:
    // PRIVATE TYPES
    typedef typename bsl::remove_const<t_TYPE>::type StoredType;

    // DATA

    // in-place `TYPE` object
    bsls::ObjectBuffer<StoredType> d_buffer;

    // `true` if object has a value, and `false` otherwise
    bool                           d_hasValue;

  public:
    // CREATORS

    /// Create an empty `Optional_DataImp` object.
    Optional_DataImp() BSLS_KEYWORD_NOEXCEPT;

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
    /// Create an `Optional_DataImp` object, which contains the result of
    /// invocation of the specified `invocable` with the specified `arg`.
    template <class t_INVOCABLE, class t_ARG>
    Optional_DataImp(Optional_InvokeConstructorTag ,
                     t_INVOCABLE&&                 invocable,
                     t_ARG&&                       arg);
#endif

    // MANIPULATORS
#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_A
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_A BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0
    t_TYPE& emplace(bslma::Allocator                            *allocator);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1
    template <class t_ARGS_01>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0
    template <class t_INIT_LIST_TYPE>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_A >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    t_TYPE& emplace(bslma::Allocator                            *allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    t_TYPE& emplace(
                 bslma::Allocator                            *allocator,
                 std::initializer_list<t_INIT_LIST_TYPE>      initializer_list,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
#  endif
// }}} END GENERATED CODE
#endif

    /// Destroy the `value_type` object in `d_buffer`, if any.
    void reset() BSLS_KEYWORD_NOEXCEPT;

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return the `value_type` object in `d_buffer` with const
    /// qualification adjusted to match that of `t_TYPE`.  The behavior is
    /// undefined unless `this->hasValue() == true`.
    t_TYPE&  value() &;
    t_TYPE&& value() &&;
# else
    /// Return the `value_type` object in `d_buffer` with const
    /// qualification adjusted to match that of `t_TYPE`.  The behavior is
    /// undefined unless `this->hasValue() == true`.
    t_TYPE& value();
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

    // ACCESSORS

    /// Return `true` if this objects has a value, and `false` otherwise.
    bool hasValue() const BSLS_KEYWORD_NOEXCEPT;

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return the `value_type` object in `d_buffer` with const
    /// qualification adjusted to match that of `t_TYPE`.  The behavior is
    /// undefined unless `this->hasValue() == true`.
    const t_TYPE&  value() const &;
    const t_TYPE&& value() const &&;

# else
    /// Return the `value_type` object in `d_buffer` with const qualification
    /// adjusted to match that of `t_TYPE`.  The behavior is undefined unless
    /// `this->hasValue() == true`.
    const t_TYPE& value() const;
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else
};

                            // ===================
                            // class Optional_Data
                            // ===================

/// This component-private `struct` manages a `value_type` object in
/// `Optional_Base` by inheriting from `Optional_DataImp`.  In addition,
/// this primary template properly destroys the owned instance of `t_TYPE`
/// in its destructor.
template <
    class t_TYPE,
    bool  t_IS_TRIVIALLY_DESTRUCTIBLE =
        bslstl::Optional_IsTriviallyDestructible<t_TYPE>::value>
struct Optional_Data : public Optional_DataImp<t_TYPE> {

  public:
    // CREATORS
#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
    using Optional_DataImp<t_TYPE>::Optional_DataImp;
#endif

    /// Destroy the managed `value_type` object, if it exists.
    ~Optional_Data();
};

                            // ===================
                            // class Optional_Data
                            // ===================

/// This partial specialization manages a trivially destructible
/// `value_type` in Optional_Base.  It does not have a user-provided
/// destructor, which makes it `is_trivially_destructible` itself.
template <class t_TYPE>
struct Optional_Data<t_TYPE, true> : public Optional_DataImp<t_TYPE> {

  public:
    BSLMF_NESTED_TRAIT_DECLARATION_IF(Optional_Data,
                                      bslmf::IsBitwiseCopyable,
                                      bslmf::IsBitwiseCopyable<t_TYPE>::value);

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
    // CREATORS
    using Optional_DataImp<t_TYPE>::Optional_DataImp;
#endif
};

                         // ==========================
                         // Component-private concepts
                         // ==========================

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
template <class t_TYPE>
void optional_acceptsBslOptional(const bsl::optional<t_TYPE>&);

template <class t_TYPE>
void optional_acceptsStdOptional(const std::optional<t_TYPE>&);

// This component-private concept models the Standard's exposition-only
// `boolean-testable` concept.
template <class t_TYPE>
concept Optional_ConvertibleToBool =
    bsl::is_convertible_v<t_TYPE, bool>;

// This component-private concept is used in the subsequent implementation
// of the component-private concept `Optional_DerivedFromOptional`.
template <class t_TYPE>
concept Optional_DerivedFromBslOptional =
    requires (const t_TYPE& t) { optional_acceptsBslOptional(t); };

// This component-private concept is used in the subsequent implementation
// of the component-private concept `Optional_DerivedFromOptional`.
template <class t_TYPE>
concept Optional_DerivedFromStdOptional =
    requires (const t_TYPE& t) { optional_acceptsStdOptional(t); };

/// This component-private concept models whether a type is derived from one
/// of `std::optional` or `bsl::optional`.
template <class t_TYPE>
concept Optional_DerivedFromOptional =
    Optional_DerivedFromBslOptional<t_TYPE> ||
    Optional_DerivedFromStdOptional<t_TYPE>;
#endif

// ============================================================================
//           Section: Definition of Allocator-Aware 'Optional_Base'
// ============================================================================

                            // ===================
                            // class Optional_Base
                            // ===================

/// This component-private class template implements the functionality of
/// `bsl::optional`.  The primary template is instantiated when `TYPE` is
/// allocator-aware, and holds the allocator that is used to create the
/// stored object.
template <class t_TYPE,
          bool  t_USES_BSLMA_ALLOC =
              BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>
class Optional_Base {

  public:
    // TYPES

    /// `value_type` is an alias for the underlying `TYPE` upon which this
    /// template class is instantiated, and represents the type of the
    /// managed object.  The name is chosen so it is compatible with the
    /// `std::optional` implementation.
    typedef t_TYPE value_type;

    typedef bsl::allocator<char> allocator_type;

  protected:
    // PROTECTED TYPES
    typedef allocator_type AllocType;

  private:
    // PRIVATE TYPES
    typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;

# ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
    // UNSPECIFIED BOOL

    /// This type is needed only in C++03 mode, where `explicit` conversion
    /// operators are not supported.  An `optional` object is contextually
    /// converted to `UnspecifiedBool` when used in `if` statements, but is not
    /// implicitly convertible to `bool`.
    typedef BloombergLP::bsls::UnspecifiedBool<Optional_Base>
                                                   UnspecifiedBoolUtil;
    typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
# endif

    // DATA

    // in-place `TYPE` object
    BloombergLP::bslstl::Optional_Data<t_TYPE> d_value;

    // allocator to be used for all in-place `TYPE` objects
    allocator_type                             d_allocator;

  protected:
    // PROTECTED CREATORS

    /// Create a disengaged `Optional_Base` object.  Use the currently
    /// installed default allocator to supply memory.
    Optional_Base();

    /// Create a disengaged `Optional_Base` object.  Use the currently
    /// installed default allocator to supply memory.
    Optional_Base(bsl::nullopt_t);                                  // IMPLICIT

    /// Create an `Optional_Base` object having the value of the specified
    /// `original` object.  Use the currently installed default allocator to
    /// supply memory.
    Optional_Base(const Optional_Base& original);

    /// Create an `Optional_Base` object having the same value as the
    /// specified `original` object by moving the contents of `original` to
    /// the newly-created object.  The allocator associated with `original`
    /// is propagated for use in the newly-created object.  `original` is
    /// left in a valid, but unspecified state.
    Optional_Base(BloombergLP::bslmf::MovableRef<Optional_Base> original)
        BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                            bsl::is_nothrow_move_constructible<t_TYPE>::value);

    /// Create an `Optional_Base` object whose contained value is
    /// initialized by forwarding from the specified `value`.  Use the
    /// currently installed default allocator to supply memory.
    template <class t_ANY_TYPE>
    Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value);

    /// Create a disengaged `Optional_Base` object if the specified
    /// `original` object is disengaged, and an `Optional_Base` object with
    /// the value of `original.value()` converted to `t_TYPE` otherwise.
    /// Use the currently installed default allocator to supply memory.
    template <class t_ANY_TYPE>
    Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>& original);

    /// Create a disengaged `Optional_Base` object if the specified
    /// `original` object is disengaged, and an `Optional_Base` object with
    /// the value of `original.value()` converted to `t_TYPE` otherwise.
    /// Use the currently installed default allocator to supply memory.
    /// `original` is left in a valid but unspecified state.
    template <class t_ANY_TYPE>
    Optional_Base(
             BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
             BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original,
             BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR(
                 t_TYPE,
                 t_ANY_TYPE));

    /// Create a disengaged `Optional_Base` object if the specified
    /// `original` object is disengaged, and an `Optional_Base` object with
    /// the value of `original.value()` otherwise.  This is a special case
    /// constructor where `t_ANY_TYPE` is a non-const version of `t_TYPE`
    /// and we use the allocator from `original` to supply memory.
    /// `original` is left in a valid but unspecified state.
    template <class t_ANY_TYPE>
    Optional_Base(
        BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
        BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(t_TYPE,
                                                                  t_ANY_TYPE));

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
    /// Create a disengaged `Optional_Base` object if the specified
    /// `original` object is disengaged, and an `Optional_Base` object with
    /// the value of `original.value()` converted to `t_TYPE` otherwise.
    /// Use the currently installed default allocator to supply memory.
    template <class t_ANY_TYPE>
    Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
                  const std::optional<t_ANY_TYPE>& original);

    /// Create a disengaged `Optional_Base` object if the specified
    /// `original` object is disengaged, and an `Optional_Base` object with
    /// the value of `original.value()` converted to `t_TYPE` otherwise.
    /// Use the currently installed default allocator to supply memory.
    template <class t_ANY_TYPE>
    Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
                  std::optional<t_ANY_TYPE>&& original);
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_B
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_B BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0
    explicit Optional_Base(bsl::in_place_t);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1
    template <class t_ARGS_01>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0
    template <class t_INIT_LIST_TYPE>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_B >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    explicit Optional_Base(bsl::in_place_t,
                           BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
#  endif
// }}} END GENERATED CODE
#endif

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
    /// Create an `Optional_Base` object, which contains the result of
    /// invocation of the specified `invocable` with the specified `arg`.
    template <class t_INVOCABLE, class t_ARG>
    Optional_Base(Optional_InvokeConstructorTag ,
                  t_INVOCABLE&&                 invocable,
                  t_ARG&&                       arg);
#endif

    // allocator-extended constructors

    /// Create a disengaged `Optional_Base` object.  Use the specified
    /// `allocator` to supply memory.
    Optional_Base(bsl::allocator_arg_t, allocator_type allocator);

    /// Create a disengaged `Optional_Base` object.  Use the specified
    /// `allocator` to supply memory.
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type allocator,
                  bsl::nullopt_t);

    /// If the specified `original` contains a value, create an
    /// `Optional_Base` object whose contained value is initialized from
    /// `*original`.  Otherwise, create a disengaged `Optional_Base` object.
    /// Use the specified `allocator` to supply memory.
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type       allocator,
                  const Optional_Base& original);

    /// If the specified `original` contains a value, create an
    /// `Optional_Base` object whose contained value is initialized by
    /// moving `*original`.  Otherwise, create a disengaged `Optional_Base`
    /// object.  Use the specified `allocator` to supply memory.  `original`
    /// is left in a valid but unspecified state.
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                                allocator,
                  BloombergLP::bslmf::MovableRef<Optional_Base> original);

    /// Create an `Optional_Base` object whose contained value is
    /// initialized by forwarding from the specified `value`.  Use the
    /// specified `allocator` to supply memory.
    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                                allocator,
                  BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value);

    /// If the specified `original` contains a value, create an
    /// `Optional_Base` object whose contained value is initialized from
    /// `*original`, converted to `t_TYPE`.  Otherwise, create a disengaged
    /// `Optional_Base`.  Use the specified `allocator` to supply memory.
    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                   allocator,
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>& original);

    /// If the specified `original` contains a value, create an
    /// `Optional_Base` object whose contained value is initialized by
    /// moving from `*original` and converting to `t_TYPE`.  Otherwise,
    /// create a disengaged `Optional_Base`.  Use the specified `allocator`
    /// to supply memory.  `original` is left in a valid but unspecified
    /// state.
    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                                     allocator,
                  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original);

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
    /// If the specified `original` contains a value, create an
    /// `Optional_Base` object whose contained value is initialized from
    /// `*original`, converted to `t_TYPE`.  Otherwise, create a disengaged
    /// `Optional_Base` object.  Use the specified `allocator` to supply
    /// memory.
    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                   allocator,
                  BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
                  const std::optional<t_ANY_TYPE>& original);

    /// If the specified `original` contains a value, create an
    /// `Optional_Base` object whose contained value is initialized from
    /// moving from `*original` and converting to `t_TYPE`.  Otherwise,
    /// create a disengaged `Optional_Base`.  Use the specified `allocator`
    /// to supply memory.  `original` is left in a valid but unspecified
    /// state.
    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type              allocator,
                  BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
                  std::optional<t_ANY_TYPE>&& original);
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_C
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_C BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1
    template <class t_ARGS_01>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0
    template <class t_INIT_LIST_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_C >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    Optional_Base(bsl::allocator_arg_t,
                  allocator_type                               allocator,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>      il,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
#  endif
// }}} END GENERATED CODE
#endif

    // PROTECTED MANIPULATORS

    /// If `*this` holds an object, assign to that object the value of the
    /// specified `rhs`, converted to `t_TYPE`.  Otherwise, construct a held
    /// object from `rhs`, converted to `t_TYPE`.  The allocators of `*this`
    /// and `rhs` remain unchanged.
    template <class t_ANY_TYPE>
    void assignOrEmplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) rhs);

# ifndef BDE_OMIT_INTERNAL_DEPRECATED
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.  Note that this function is only intended to
    /// be called by `bdlb::NullableValue::value` during transition of its
    /// implementation to use 'bsl::Optional_Base.  Note that ref-qualified
    /// versions of `value()` are not provided because `NullableValue` does
    /// not require them.
    t_TYPE& dereferenceRaw();

    // PROTECTED ACCESSORS

    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.  Note that this function is only intended to
    /// be called by `bdlb::NullableValue::value` during transition of its
    /// implementation to use 'bsl::Optional_Base.  Note that ref-qualified
    /// versions of `value()` are not provided because `NullableValue` does
    /// not require them.
    const t_TYPE& dereferenceRaw() const;
# endif  // BDE_OMIT_INTERNAL_DEPRECATED

  public:
    // TRAITS
    BSLMF_NESTED_TRAIT_DECLARATION(Optional_Base,
                                   BloombergLP::bslma::UsesBslmaAllocator);
    BSLMF_NESTED_TRAIT_DECLARATION(Optional_Base,
                                   BloombergLP::bslmf::UsesAllocatorArgT);
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                         Optional_Base,
                         BloombergLP::bslmf::IsBitwiseMoveable,
                         BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                         Optional_Base,
                         BloombergLP::bslmf::IsBitwiseCopyable,
                         BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);

    // MANIPULATORS

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_D
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_D BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0
    t_TYPE& emplace();
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1
    template <class t_ARGS_01>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0
    template <class t_INIT_LIST_TYPE>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_D >= 10


#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#  endif
// }}} END GENERATED CODE
#endif
    /// Reset this object to the default constructed state (i.e., to a
    /// disengaged state).
    void reset() BSLS_KEYWORD_NOEXCEPT;

    /// Efficiently exchange the value of this object with the value of the
    /// specified `other` object.  This method provides the no-throw
    /// exception-safety guarantee if the template parameter `t_TYPE` provides
    /// that guarantee and the result of the `hasValue` method for the two
    /// objects being swapped is the same.  The behavior is undefined unless
    /// this object was created with the same allocator as `other`.
    void swap(Optional_Base& other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                           bsl::is_nothrow_move_constructible<t_TYPE>::value &&
                           bsl::is_nothrow_swappable<t_TYPE>::value);

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object if `true == has_value()` and throw
    /// `bsl::bad_optional_access` otherwise.
    t_TYPE&  value() &;
    t_TYPE&& value() &&;
# else
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  Throws a `bsl::bad_optional_access` if the
    /// `Optional_Base` object is disengaged.
    t_TYPE& value();
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a copy of the underlying object of a (template parameter)
    /// `t_TYPE` if this object is non-null, and the specified `value`
    /// converted to `t_TYPE` otherwise.  Note that this method returns *by*
    /// *value*, so may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(t_ANY_TYPE&& value) &&;
#  ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
    /// If this object is non-null, return a copy of the underlying object
    /// of a (template parameter) `t_TYPE` created using the provided
    /// allocator, and the specified `value` converted to `t_TYPE` using the
    /// specified `allocator` otherwise.  Note that this method returns *by*
    /// *value*, so may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(bsl::allocator_arg_t,
                    allocator_type,
                    t_ANY_TYPE&& value) &&;
#  endif  // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS

    /// Assign to this object the value of the specified `rhs` object, and
    /// return a non-`const` reference to this object.
    Optional_Base& operator=(const Optional_Base& rhs);

    /// Assign to this object the value of the specified `rhs` object, and
    /// return a non-`const` reference to this object.  The allocators of this
    /// object and `rhs` both remain unchanged.  The contents of `rhs` are
    /// either move-constructed into or move-assigned to this object.  `rhs` is
    /// left in a valid but unspecified state.
    Optional_Base& operator=(
                            BloombergLP::bslmf::MovableRef<Optional_Base> rhs);

    /// Return a pointer providing modifiable access to the underlying `t_TYPE`
    /// object.  The behavior is undefined if the `Optional_Base` object is
    /// disengaged.
    t_TYPE *operator->();

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.
    t_TYPE&  operator*() &;
    t_TYPE&& operator*() &&;
# else
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.
    t_TYPE& operator*();
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

    // ACCESSORS

    /// Return allocator used for construction of `value_type`.
    allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT;

    /// Return `false` if this object is disengaged, and `true` otherwise.
    bool has_value() const BSLS_KEYWORD_NOEXCEPT;

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object if `true == has_value()` and throw
    /// `bsl::bad_optional_access` otherwise.
    const t_TYPE&  value() const &;
    const t_TYPE&& value() const &&;
# else
    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object.  Throws a `bsl::bad_optional_access` if the
    /// `Optional_Base` object is disengaged.
    const t_TYPE& value() const;
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

    /// Return a pointer providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.
    const t_TYPE *operator->() const;

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.
    const t_TYPE&  operator*() const &;
    const t_TYPE&& operator*() const &&;
# else
    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.
    const t_TYPE& operator*() const;
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a copy of the underlying object of a (template parameter)
    /// `t_TYPE` if this object is non-null, and the specified `value`
    /// converted to `t_TYPE` otherwise.  Note that this method returns *by*
    /// *value*, so may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&;
#  ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
    /// If this object is non-null, return a copy of the underlying object
    /// of a (template parameter) `t_TYPE` created using the provided
    /// allocator, and the specified `value` converted to `t_TYPE` using the
    /// specified `allocator` otherwise.  Note that this method returns *by*
    /// *value*, so may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(
                   bsl::allocator_arg_t,
                   allocator_type,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&;
#  endif  // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
# else
    /// Return a copy of the underlying object of a (template parameter)
    /// `t_TYPE` if this object is non-null, and the specified `value`
    /// converted to `t_TYPE` otherwise.  Note that this method returns **by
    /// value**, so may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const;
#  ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
    /// If this object is non-null, return a copy of the underlying object of a
    /// (template parameter) `t_TYPE` created using the provided allocator, and
    /// the specified `value` converted to `t_TYPE` using the specified
    /// `allocator` otherwise.  Note that this method returns **by value**, so
    /// may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(bsl::allocator_arg_t,
                   allocator_type,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const;
#  endif  // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
    /// Return `false` if this object is disengaged, and `true` otherwise.
    explicit operator bool() const BSLS_KEYWORD_NOEXCEPT;
#else
    /// Simulation of explicit conversion to bool.  Inlined to work around xlC
    /// bug when out-of-line.
    operator UnspecifiedBool() const BSLS_NOTHROW_SPEC
    {
        return UnspecifiedBoolUtil::makeValue(has_value());
    }
#endif  // BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT else
};

// ============================================================================
//      Section: Definition of C++17 Allocator-Unaware 'Optional_Base'
// ============================================================================

                     // ==================================
                     // class Optional_Base<t_TYPE, false>
                     // ==================================

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
/// Specialization of `Optional_Base` for `value_type` that is not
/// allocator-aware when `std::optional` is available.
template <class t_TYPE>
class Optional_Base<t_TYPE, false> : public std::optional<t_TYPE> {

  private:
    // PRIVATE TYPES
    typedef std::optional<t_TYPE> StdOptionalBase;

  protected:
    // PROTECTED TYPES
    struct AllocType {
      private:
        // NOT IMPLEMENTED

        /// This constructor prevents `AllocType` from being an aggregate.
        explicit AllocType(int) = delete;
    };

    // PROTECTED CREATORS

    /// Create a disengaged `Optional_Base` object.
    constexpr Optional_Base();

    /// Create a disengaged `Optional_Base` object.
    constexpr Optional_Base(bsl::nullopt_t);                        // IMPLICIT

    /// Create an `Optional_Base` object whose contained value is initialized
    /// by forwarding from the specified `value`.
    template <class t_ANY_TYPE>
    constexpr
    Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                  t_ANY_TYPE&& value);

    /// Create a disengaged `Optional_Base` object if the specified `original`
    /// object is disengaged, and an `Optional_Base` object with the value of
    /// `original.value()` (of `t_ANY_TYPE`) converted to `t_TYPE` otherwise.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>& original);

    /// Create a disengaged `Optional_Base` object if the specified `original`
    /// object is disengaged, and an `Optional_Base` object with the value of
    /// `original.value()` (of `t_ANY_TYPE`) converted to `t_TYPE` otherwise.
    /// `original` is left in a valid but unspecified state.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  Optional_Base<t_ANY_TYPE>&& original);

    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
                  const std::optional<t_ANY_TYPE>& original);

    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
                  std::optional<t_ANY_TYPE>&& original);

    /// Create an `Optional_Base` object whose contained value is initialized
    /// from the specified `args`.
    template <class... t_ARGS>
    explicit constexpr Optional_Base(bsl::in_place_t, t_ARGS&&... args);

    /// Create an `Optional_Base` object whose contained value is initialized
    /// from the specified `il` and `args`.
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    constexpr
    Optional_Base(bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE> il,
                  t_ARGS&&...                             args);

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
    /// Create an `Optional_Base` object, which contains the result of
    /// invocation of the specified `invocable` with the specified `arg`.
    template <class t_INVOCABLE, class t_ARG>
    Optional_Base(Optional_InvokeConstructorTag ,
                  t_INVOCABLE&&                 invocable,
                  t_ARG&&                       arg);
#endif

    /// These allocator-extended constructors cannot be called, and are
    /// provided only to prevent compilation errors when 'optional' is
    /// explicitly instantiated.
    Optional_Base(bsl::allocator_arg_t, AllocType);

    Optional_Base(bsl::allocator_arg_t, AllocType, bsl::nullopt_t);

    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                  t_ANY_TYPE&&);

    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>&);

    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  Optional_Base<t_ANY_TYPE>&&);

    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
                  const std::optional<t_ANY_TYPE>&);

    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
                  std::optional<t_ANY_TYPE>&&);

    template <class... t_ARGS>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  t_ARGS&&...);

    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  t_ARGS&&...);

    // PROTECTED MANIPULATORS

    /// If `*this` holds an object, assign to that object the value of the
    /// specified `rhs`, converted to `t_TYPE`.  Otherwise, construct a held
    /// object from `rhs`, converted to `t_TYPE`.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20 void assignOrEmplace(t_ANY_TYPE&& rhs);

#  ifndef BDE_OMIT_INTERNAL_DEPRECATED
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.  Note that this function is only intended to
    /// be called by `bdlb::NullableValue::value` during transition of its
    /// implementation to use 'bsl::Optional_Base.  Note that ref-qualified
    /// versions of `value()` are not provided because `NullableValue` does
    /// not require them.
    t_TYPE& dereferenceRaw();

    // PROTECTED ACCESSORS

    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.  Note that this function is only intended to
    /// be called by `bdlb::NullableValue::value` during transition of its
    /// implementation to use 'bsl::Optional_Base.  Note that ref-qualified
    /// versions of `value()` are not provided because `NullableValue` does
    /// not require them.
    const t_TYPE& dereferenceRaw() const;
#  endif  // BDE_OMIT_INTERNAL_DEPRECATED

  public:
    // TRAITS
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                         Optional_Base,
                         BloombergLP::bslmf::IsBitwiseMoveable,
                         BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                         Optional_Base,
                         BloombergLP::bslmf::IsBitwiseCopyable,
                         BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);
};
# else  // BSLSTL_OPTIONAL_USES_STD_ALIASES

// ============================================================================
//     Section: Definition of Pre-C++17 Allocator-Unaware 'Optional_Base'
// ============================================================================

                     // ==================================
                     // class Optional_Base<t_TYPE, false>
                     // ==================================

/// Specialization of `Optional_Base` for `value_type` that is not
/// allocator-aware.
template <class t_TYPE>
class Optional_Base<t_TYPE, false> {

  private:
    // PRIVATE TYPES
    typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;

# ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
    // UNSPECIFIED BOOL

    /// This type is needed only in C++03 mode, where 'explicit' conversion
    /// operators are not supported.  An 'optional' object is contextually
    /// converted to 'UnspecifiedBool' when used in 'if' statements, but is not
    /// implicitly convertible to 'bool'.
    typedef BloombergLP::bsls::UnspecifiedBool<Optional_Base>
                                                   UnspecifiedBoolUtil;
    typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
# endif

    // DATA

    /// in-place `TYPE` object
    BloombergLP::bslstl::Optional_Data<t_TYPE> d_value;

  protected:
    // PROTECTED TYPES
    struct AllocType {
      private:
        // NOT IMPLEMENTED

        /// This constructor prevents `AllocType` from being an aggregate.
        explicit AllocType(int) BSLS_KEYWORD_DELETED;
    };

    // PROTECTED CREATORS

    /// Create a disengaged `Optional_Base` object.
    Optional_Base();

    /// Create a disengaged `Optional_Base` object.
    Optional_Base(bsl::nullopt_t);                                  // IMPLICIT

    /// Create an `Optional_Base` object having the value of the specified
    /// `original` object.
    Optional_Base(const Optional_Base& original);

    /// Create an `Optional_Base` object having the same value as the
    /// specified `original` object by moving the contents of `original` to
    /// the newly-created object.  `original` is left in a valid, but
    /// unspecified state.
    Optional_Base(BloombergLP::bslmf::MovableRef<Optional_Base> original)
        BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                            bsl::is_nothrow_move_constructible<t_TYPE>::value);

    /// Create an `Optional_Base` object whose contained value is initialized
    /// by forwarding from the specified `value`.
    template <class t_ANY_TYPE>
    Optional_Base(BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value);

    /// Create a disengaged `Optional_Base` object if the specified
    /// `original` object is disengaged, and an `Optional_Base` object with
    /// the value of `original.value()` converted to `t_TYPE` otherwise.
    template <class t_ANY_TYPE>
    Optional_Base(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>& original);

    /// Create a disengaged `Optional_Base` object if the specified
    /// `original` object is disengaged, and an `Optional_Base` object with
    /// the value of `original.value()` converted to `t_TYPE` otherwise.
    /// `original` is left in a valid but unspecified state.
    template <class t_ANY_TYPE>
    Optional_Base(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original);

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_E
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_E BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0
    explicit Optional_Base(bsl::in_place_t);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1
    template <class t_ARGS_01>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    explicit Optional_Base(bsl::in_place_t,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10


#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0
    template <class t_INIT_LIST_TYPE>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_E >= 10

#   endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    explicit Optional_Base(bsl::in_place_t,
                           BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    explicit Optional_Base(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                           BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
#   endif
// }}} END GENERATED CODE
#endif

    /// These allocator-extended constructors cannot be called, and are provided
    /// only to prevent compilation errors when `optional` is explicitly
    /// instantiated.
    Optional_Base(bsl::allocator_arg_t, AllocType);

    Optional_Base(bsl::allocator_arg_t, AllocType, bsl::nullopt_t);

    Optional_Base(bsl::allocator_arg_t, AllocType, const Optional_Base&);

    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslmf::MovableRef<Optional_Base>);

    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE));

    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>&);

    template <class t_ANY_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>));

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_F
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_F BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1
    template <class t_ARGS_01>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10


#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0
    template <class t_INIT_LIST_TYPE>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09),
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10));
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_F >= 10

#   endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...);

#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    Optional_Base(bsl::allocator_arg_t,
                  AllocType,
                  bsl::in_place_t,
                  std::initializer_list<t_INIT_LIST_TYPE>,
                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...);
#   endif
// }}} END GENERATED CODE
#endif

    // PROTECTED MANIPULATORS

    /// If `*this` holds an object, assign to that object the value of
    /// `rhs`, converted to `t_TYPE`.  Otherwise, construct a held object
    /// from `rhs`, converted to `t_TYPE`.
    template <class t_ANY_TYPE>
    void assignOrEmplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) rhs);

#  ifndef BDE_OMIT_INTERNAL_DEPRECATED
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.  Note that this function is only intended to
    /// be called by `bdlb::NullableValue::value` during transition of its
    /// implementation to use `bsl::Optional_Base`.  Note that ref-qualified
    /// versions of `value()` are not provided because `NullableValue` does
    /// not require them.
    t_TYPE& dereferenceRaw();

    // PROTECTED ACCESSORS

    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if the `Optional_Base`
    /// object is disengaged.  Note that this function is only intended to
    /// be called by `bdlb::NullableValue::value` during transition of its
    /// implementation to use `bsl::Optional_Base`.  Note that ref-qualified
    /// versions of `value()` are not provided because `NullableValue` does
    /// not require them.
    const t_TYPE& dereferenceRaw() const;
#  endif  // !BDE_OMIT_INTERNAL_DEPRECATED

  public:
    // TYPES

    /// `value_type` is an alias for the underlying `t_TYPE` upon which this
    /// template class is instantiated, and represents the type of the
    /// managed object.  The name is chosen so it is compatible with the
    /// `std::optional` implementation.
    typedef t_TYPE value_type;

    // TRAITS
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                         Optional_Base,
                         BloombergLP::bslmf::IsBitwiseMoveable,
                         BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                         Optional_Base,
                         BloombergLP::bslmf::IsBitwiseCopyable,
                         BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);

    // MANIPULATORS
#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_G
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_G BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0
    t_TYPE& emplace();
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1
    template <class t_ARGS_01>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10


#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0
    template <class t_INIT_LIST_TYPE>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_G >= 10

#   endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    t_TYPE& emplace(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    t_TYPE& emplace(std::initializer_list<t_INIT_LIST_TYPE>      il,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
#   endif
// }}} END GENERATED CODE
#endif

    /// Reset this object to the default constructed state (i.e., to be in a
    /// disengaged state).
    void reset() BSLS_KEYWORD_NOEXCEPT;

    /// Efficiently exchange the value of this object with the value of the
    /// specified `other` object.  This method provides the no-throw
    /// exception-safety guarantee if the template parameter `t_TYPE`
    /// provides that guarantee and the result of the `hasValue` method for
    /// the two objects being swapped is the same.
    void swap(Optional_Base& other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                           bsl::is_nothrow_move_constructible<t_TYPE>::value &&
                           bsl::is_nothrow_swappable<t_TYPE>::value);

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object if `true == has_value()` and throw
    /// `bsl::bad_optional_access` otherwise.
    t_TYPE&  value() &;
    t_TYPE&& value() &&;
#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  Throws a `bsl::bad_optional_access` if the
    /// `Optional_Base` object is disengaged.
    t_TYPE& value();
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a copy of the underlying object of a (template parameter)
    /// 't_TYPE' if this object is non-null, and the specified 'value'
    /// converted to 't_TYPE' otherwise.  Note that this method returns **by
    /// value**, so may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(t_ANY_TYPE&& value) &&;
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS

    /// Assign to this object the value of the specified `rhs` object, and
    /// return a non-`const` reference to this object.
    Optional_Base& operator=(const Optional_Base& rhs);

    /// Assign to this object the value of the specified `rhs` object, and
    /// return a non-`const` reference to this object.  The allocators of this
    /// object and `rhs` both remain unchanged.  The contents of `rhs` are
    /// either move-constructed into or move-assigned to this object.  `rhs` is
    /// left in a valid but unspecified state.
    Optional_Base& operator=(
                            BloombergLP::bslmf::MovableRef<Optional_Base> rhs);

    /// Return a pointer providing modifiable access to the underlying `t_TYPE`
    /// object.  The behavior is undefined if this object is disengaged.
    t_TYPE *operator->();

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if this object is
    /// disengaged.
    t_TYPE&  operator*() &;
    t_TYPE&& operator*() &&;
#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if this object is
    /// disengaged.
    t_TYPE& operator*();
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

    // ACCESSORS

    /// Return `false` if this object is disengaged, and `true` otherwise.
    bool has_value() const BSLS_KEYWORD_NOEXCEPT;

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object if `true == has_value()` and throw
    /// `bsl::bad_optional_access` otherwise.
    const t_TYPE&  value() const &;
    const t_TYPE&& value() const &&;
#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing non-modifiable access to the underlying
    /// 't_TYPE' object.  Throws a 'bsl::bad_optional_access' if the
    /// 'Optional_Base' object is disengaged.
    const t_TYPE& value() const;
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a copy of the underlying object of a (template parameter)
    /// `t_TYPE` if this object is non-null, and the specified `value`
    /// converted to `t_TYPE` otherwise.  Note that this method returns **by
    /// value**, so may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&;
#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a copy of the underlying object of a (template parameter)
    /// `t_TYPE` if this object is non-null, and the specified `value`
    /// converted to `t_TYPE` otherwise.  Note that this method returns **by
    /// value**, so may be inefficient in some contexts.
    template <class t_ANY_TYPE>
    t_TYPE value_or(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const;
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

    /// Return a pointer providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if this object is
    /// disengaged.
    const t_TYPE *operator->() const;

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if this object is
    /// disengaged.
    const t_TYPE&  operator*() const&;
    const t_TYPE&& operator*() const&&;
#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
    /// Return a reference providing non-modifiable access to the underlying
    /// `t_TYPE` object.  The behavior is undefined if this object is
    /// disengaged.
    const t_TYPE& operator*() const;
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
    /// Return `false` if this object is disengaged, and `true` otherwise.
    explicit operator bool() const BSLS_KEYWORD_NOEXCEPT;
#else
    /// Simulation of explicit conversion to bool.  Inlined to work around xlC
    /// bug when out-of-line.
    operator UnspecifiedBool() const BSLS_NOTHROW_SPEC
    {
        return UnspecifiedBoolUtil::makeValue(has_value());
    }
#endif  // BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT else
};
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES else

}  // close package namespace
}  // close enterprise namespace

namespace bsl {

// ============================================================================
//             Section: Definition of Class Template 'optional'
// ============================================================================

                               // ==============
                               // class optional
                               // ==============

template <class t_TYPE>
class optional : public BloombergLP::bslstl::Optional_Base<t_TYPE> {
  private:
    // PRIVATE TYPES
    typedef BloombergLP::bslstl::Optional_Base<t_TYPE> BaseType;

    typedef typename BaseType::AllocType AllocType;

    typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
    // FRIENDS
    template <class t_ANY_TYPE> friend class optional;

    // PRIVATE CREATORS

    /// Create an `optional` object, which contains the result of invocation of
    /// the specified `invocable` with the specified `arg`.
    template <class t_INVOCABLE, class t_ARG>
    optional(BloombergLP::bslstl::Optional_InvokeConstructorTag ,
             t_INVOCABLE&&                                      invocable,
             t_ARG&&                                            arg);
#endif

  public:
    // TRAITS
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                        optional,
                        BloombergLP::bslma::UsesBslmaAllocator,
                        BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value);
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                        optional,
                        BloombergLP::bslmf::UsesAllocatorArgT,
                        BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value);
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                         optional,
                         BloombergLP::bslmf::IsBitwiseMoveable,
                         BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value);
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
                         optional,
                         BloombergLP::bslmf::IsBitwiseCopyable,
                         BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value);

    // CREATORS

    /// Create a disengaged `optional` object.  Use the currently installed
    /// default allocator to supply memory.  This constructor can be called in
    /// constant expressions only when `t_TYPE` is not allocator-aware.
    BSLSTL_OPTIONAL_CONSTEXPR17 optional() BSLS_KEYWORD_NOEXCEPT;

    /// Create a disengaged `optional` object.  Use the currently installed
    /// default allocator to supply memory.  This constructor can be called in
    /// constant expressions only when `t_TYPE` is not allocator-aware.
    BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT;                 // IMPLICIT

#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
    /// If the `optional` base class of the specified `original` holds a
    /// value, create an `optional` object whose contained value is
    /// initialized by moving from that value; otherwise, create a
    /// disengaged `optional` object.  The allocator associated with the
    /// `optional` base class of `original` is propagated for use in the
    /// newly-created object.  `original` is left in a valid, but
    /// unspecified state.  Note that this constructor does not participate
    /// in overload resolution unless `optional` is an accessible base class
    /// of `t_DERIVED` or `t_DERIVED` is `optional` itself (in which case
    /// the instantiation provides the move constructor in C++03; a move
    /// constructor is implicitly declared in C++11).
    template <class t_DERIVED>
    optional(BloombergLP::bslmf::MovableRef<t_DERIVED> original,
             BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(t_DERIVED))
             BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
               bsl::is_nothrow_move_constructible<t_TYPE>::value);  // IMPLICIT
#endif

    /// Create an `optional` object whose contained value is initialized by
    /// forwarding from the specified `value`.  Use the currently installed
    /// default allocator to supply memory.  Note that this constructor
    /// participates in overload resolution only when `t_TYPE` is
    /// constructible from `t_ANY_TYPE` and is implicit only when
    /// `t_ANY_TYPE` is implicitly convertible to `t_TYPE`.  This constructor
    /// can be called in constant expressions only when `t_TYPE` is not
    /// allocator-aware.
    template <class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
    BSLSTL_OPTIONAL_CONSTEXPR17
    optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
             BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE),
             BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                               t_ANY_TYPE));
                                                                    // IMPLICIT
    template <class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
    BSLSTL_OPTIONAL_CONSTEXPR17
    explicit optional(
            BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
            BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE),
            BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));

    /// Create a disengaged `optional` object if the specified `original`
    /// object is disengaged, and an `optional` object with the value of
    /// `original.value()` converted to `t_TYPE` otherwise.  Use the
    /// currently installed default allocator to supply memory.  Note that
    /// this constructor participates in overload resolution only when
    /// `t_TYPE` is constructible from an lvalue of `const t_ANY_TYPE`, and
    /// is implicit only when an lvalue of `const t_ANY_TYPE` is implicitly
    /// convertible to `t_TYPE`.  This constructor can be called in constant
    /// expressions only when neither `t_TYPE` nor `t_ANY_TYPE` is
    /// allocator-aware.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20 optional(
         const optional<t_ANY_TYPE>& original,
         BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(
             t_TYPE,
             const t_ANY_TYPE&),
         BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                           const t_ANY_TYPE&));
                                                                    // IMPLICIT
    template <class t_ANY_TYPE>
    explicit BSLSTL_OPTIONAL_CONSTEXPR20 optional(
         const optional<t_ANY_TYPE>& original,
         BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(
             t_TYPE,
             const t_ANY_TYPE&),
         BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE,
                                                       const t_ANY_TYPE&));

    /// Create a disengaged `optional` object if the specified `original`
    /// object is disengaged, and an `optional` object with the value of
    /// `original.value()` moved and converted to `t_TYPE` otherwise.  Use
    /// the allocator from `original` to supply memory if `t_ANY_TYPE` is a
    /// non-const version of `t_TYPE`; otherwise, use the currently
    /// installed default allocator.  `original` is left in a valid but
    /// unspecified state.  Note that this constructor participates in
    /// overload resolution only when `t_TYPE` is constructible from an
    /// xvalue of `t_ANY_TYPE`, and is implicit only when an xvalue of
    /// `t_ANY_TYPE` is implicitly convertible to `t_TYPE`.  This constructor
    /// can be called in constant expressions only when neither `t_TYPE` nor
    /// `t_ANY_TYPE` is allocator-aware.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20 optional(
        BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE,
                                                                t_ANY_TYPE),
        BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));
                                                                    // IMPLICIT
    template <class t_ANY_TYPE>
    explicit BSLSTL_OPTIONAL_CONSTEXPR20 optional(
        BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE,
                                                                t_ANY_TYPE),
        BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
    /// Create a disengaged `optional` object if the specified `original`
    /// object is disengaged, and an `optional` object with the value of
    /// `original.value()` converted to `t_TYPE` otherwise.  Use the
    /// currently installed default allocator to supply memory.  Note that
    /// this constructor participates in overload resolution only when
    /// `t_TYPE` is constructible from an lvalue of `const t_ANY_TYPE`, and
    /// is implicit only when an lvalue of `const t_ANY_TYPE` is implicitly
    /// convertible to `t_TYPE`.  This constructor can be called in constant
    /// expressions only when `t_TYPE` is not allocator-aware.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20 optional(
            const std::optional<t_ANY_TYPE>& original,
            BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(
                t_TYPE,
                const t_ANY_TYPE&),
            BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                              t_ANY_TYPE));
                                                                    // IMPLICIT
    template <class t_ANY_TYPE>
    explicit BSLSTL_OPTIONAL_CONSTEXPR20 optional(
            const std::optional<t_ANY_TYPE>& original,
            BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(
                t_TYPE,
                const t_ANY_TYPE&),
            BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));

    /// Create a disengaged `optional` object if the specified `original`
    /// object is disengaged, and an `optional` object with the value of
    /// `original.value()` converted to `t_TYPE` otherwise.  Use the
    /// currently installed default allocator to supply memory.  Note that
    /// this constructor participates in overload resolution only when
    /// `t_TYPE` is constructible from an xvalue of `t_ANY_TYPE`, and is
    /// implicit only when an xvalue of `t_ANY_TYPE` is implicitly
    /// convertible to `t_TYPE`.  This constructor can be called in constant
    /// expressions only when `t_TYPE` is not allocator-aware.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20 optional(
        std::optional<t_ANY_TYPE>&& original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE,
                                                                t_ANY_TYPE),
        BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));
                                                                    // IMPLICIT
    template <class t_ANY_TYPE>
    explicit BSLSTL_OPTIONAL_CONSTEXPR20 optional(
        std::optional<t_ANY_TYPE>&& original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE,
                                                                t_ANY_TYPE),
        BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_H
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_H BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1
    template <class t_ARGS_01>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0
    template <class t_INIT_LIST_TYPE>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_H >= 10

#endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    explicit BSLSTL_OPTIONAL_CONSTEXPR17
    optional(bsl::in_place_t,
             std::initializer_list<t_INIT_LIST_TYPE>      il,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
#endif
// }}} END GENERATED CODE
#endif

    // These allocator-extended constructors can be called only when 't_TYPE'
    // is allocator-aware.

    /// Create a disengaged `optional` object.  Use the specified
    /// `allocator` to supply memory.
    optional(bsl::allocator_arg_t, AllocType allocator);

    /// Create a disengaged `optional` object.  Use the specified
    /// `allocator` to supply memory.
    optional(bsl::allocator_arg_t, AllocType allocator, bsl::nullopt_t);

    /// If the specified `original` contains a value, create an `optional`
    /// object whose contained value is initialized from `*original`;
    /// otherwise, create a disengaged `optional` object.  Use the specified
    /// `allocator` to supply memory.
    optional(bsl::allocator_arg_t,
             AllocType       allocator,
             const optional& original);

    /// If the `optional` base class of the specified `original` holds a
    /// value, create an `optional` object whose contained value is
    /// initialized by moving from that value; otherwise, create a
    /// disengaged `optional` object.  Use the specified `allocator` to
    /// supply memory.  `original` is left in a valid, but unspecified
    /// state.  Note that this constructor does not participate in overload
    /// resolution unless `optional` is an accessible base class of
    /// `t_DERIVED` or `t_DERIVED` is `optional` itself (in which case the
    /// instantiation provides the allocator-extended move constructor).
    template <class t_DERIVED>
    optional(bsl::allocator_arg_t,
             AllocType                          allocator,
             BSLMF_MOVABLEREF_DEDUCE(t_DERIVED) original,
             BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(
                             typename bsl::remove_reference<t_DERIVED>::type));

    /// Create an `optional` object whose contained value is initialized by
    /// forwarding from the specified `value`.  Use the specified
    /// `allocator` to supply memory.  Note that this constructor
    /// participates in overload resolution only when `t_TYPE` is
    /// constructible from `t_ANY_TYPE`, and is implicit only when
    /// `t_ANY_TYPE` is implicitly convertible to `t_TYPE`.
    template <class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
    optional(bsl::allocator_arg_t,
             AllocType                                     allocator,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
             BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE),
             BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                               t_ANY_TYPE));
    template <class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG(t_TYPE)>
    explicit optional(
            bsl::allocator_arg_t,
            AllocType                                     allocator,
            BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
            BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE),
            BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));

    /// Create a disengaged `optional` object if the specified `original`
    /// object is disengaged, and an `optional` object with the value of
    /// `original.value()` converted to `t_TYPE` otherwise.  Use the
    /// specified `allocator` to supply memory.  Note that this constructor
    /// participates in overload resolution only when `t_TYPE` is
    /// constructible from an lvalue of `const t_ANY_TYPE`, and is implicit
    /// only when an lvalue of `const t_ANY_TYPE` is implicitly convertible
    /// to `t_TYPE`.
    template <class t_ANY_TYPE>
    optional(
         bsl::allocator_arg_t,
         AllocType                   allocator,
         const optional<t_ANY_TYPE>& original,
         BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(
             t_TYPE,
             const t_ANY_TYPE&),
         BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                           const t_ANY_TYPE&));
    template <class t_ANY_TYPE>
    explicit optional(
         bsl::allocator_arg_t,
         AllocType                   allocator,
         const optional<t_ANY_TYPE>& original,
         BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(
             t_TYPE,
             const t_ANY_TYPE&),
         BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE,
                                                       const t_ANY_TYPE&));

    /// Create a disengaged `optional` object if the specified `original`
    /// object is disengaged, and an `optional` object with the value of
    /// `original.value()` moved and converted to `t_TYPE` otherwise.  Use
    /// the specified `allocator` to supply memory.  `original` is left in a
    /// valid but unspecified state.  Note that this constructor
    /// participates in overload resolution only when `t_TYPE` is
    /// constructible from an xvalue of `t_ANY_TYPE`, and is implicit only
    /// when an xvalue of `t_ANY_TYPE` is implicitly convertible to
    /// `t_TYPE`.
    template <class t_ANY_TYPE>
    optional(
        bsl::allocator_arg_t,
        AllocType                                     allocator,
        BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE,
                                                                t_ANY_TYPE),
        BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));
    template <class t_ANY_TYPE>
    explicit optional(
        bsl::allocator_arg_t,
        AllocType                                     allocator,
        BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE,
                                                                t_ANY_TYPE),
        BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
    /// Create a disengaged `optional` object if the specified `original`
    /// object is disengaged, and an `optional` object with the value of
    /// `original.value()` converted to `t_TYPE` otherwise.  Use the
    /// specified `allocator` to supply memory.  Note that this constructor
    /// participates in overload resolution only when `t_TYPE` is
    /// constructible from an lvalue of `const t_ANY_TYPE`, and is implicit
    /// only when an lvalue of `const t_ANY_TYPE` is implicitly convertible
    /// to `t_TYPE`.
    template <class t_ANY_TYPE>
    optional(
         bsl::allocator_arg_t,
         AllocType                        allocator,
         const std::optional<t_ANY_TYPE>& original,
         BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(
             t_TYPE,
             const t_ANY_TYPE&),
         BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                           const t_ANY_TYPE&));
    template <class t_ANY_TYPE>
    explicit optional(
         bsl::allocator_arg_t,
         AllocType                        allocator,
         const std::optional<t_ANY_TYPE>& original,
         BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(
             t_TYPE,
             const t_ANY_TYPE&),
         BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE,
                                                       const t_ANY_TYPE));

    /// Create a disengaged `optional` object if the specified `original`
    /// object is disengaged, and an `optional` object with the value of
    /// `original.value()` moved and converted to `t_TYPE` otherwise.  Use
    /// the specified `allocator` to supply memory.  `original` is left in a
    /// valid but unspecified state.  Note that this constructor
    /// participates in overload resolution only when `t_TYPE` is
    /// constructible from an xvalue of `t_ANY_TYPE`, and is implicit only
    /// when an xvalue of `t_ANY_TYPE` is implicitly convertible to
    /// `t_TYPE`.
    template <class t_ANY_TYPE>
    optional(
        bsl::allocator_arg_t,
        AllocType                   allocator,
        std::optional<t_ANY_TYPE>&& original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE,
                                                                t_ANY_TYPE),
        BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));
    template <class t_ANY_TYPE>
    explicit optional(
        bsl::allocator_arg_t,
        AllocType                   allocator,
        std::optional<t_ANY_TYPE>&& original,
        BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE,
                                                                t_ANY_TYPE),
        BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE));
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_I
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_I BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1
    template <class t_ARGS_01>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2
    template <class t_ARGS_01,
              class t_ARGS_02>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10
    template <class t_ARGS_01,
              class t_ARGS_02,
              class t_ARGS_03,
              class t_ARGS_04,
              class t_ARGS_05,
              class t_ARGS_06,
              class t_ARGS_07,
              class t_ARGS_08,
              class t_ARGS_09,
              class t_ARGS_10>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0
    template <class t_INIT_LIST_TYPE>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1
    template <class t_INIT_LIST_TYPE, class t_ARGS_01>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10
    template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                      class t_ARGS_02,
                                      class t_ARGS_03,
                                      class t_ARGS_04,
                                      class t_ARGS_05,
                                      class t_ARGS_06,
                                      class t_ARGS_07,
                                      class t_ARGS_08,
                                      class t_ARGS_09,
                                      class t_ARGS_10>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_I >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... t_ARGS>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
    template <class t_INIT_LIST_TYPE, class... t_ARGS>
    explicit optional(bsl::allocator_arg_t,
                      AllocType                                    allocator,
                      bsl::in_place_t,
                      std::initializer_list<t_INIT_LIST_TYPE>      il,
                      BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);
#  endif
// }}} END GENERATED CODE
#endif

    // MANIPULATORS

    // We implement 'operator=' in the most derived class to avoid having to
    // repeat constraints in each of the three implementations of
    // 'Optional_Base'.

    /// Reset this object to be disengaged and return a reference providing
    /// modifiable access to this object.  This assignment operator can be
    /// called in constant expressions only when `t_TYPE` is not
    /// allocator-aware.
    BSLSTL_OPTIONAL_CONSTEXPR20
    optional& operator=(bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT;

#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
    /// If the `optional` base class of the specified `rhs` holds a value,
    /// move-construct or move-assign the contained value of `*this` from
    /// that value.  Otherwise, set `*this` to be disengaged.  Return a
    /// reference providing modifiable access to this object.  `rhs` is left
    /// in a valid but unspecified state.  This method does not participate
    /// in overload resolution unless `optional` is an accessible base class
    /// of `t_DERIVED` or `t_DERIVED` is `optional` itself (in which case
    /// the instantiation provides the move assignment operator in C++03; a
    /// move assignment operator is implicitly declared in C++11).
    template <class t_DERIVED>
    BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED(t_TYPE, t_DERIVED)&
    operator=(BloombergLP::bslmf::MovableRef<t_DERIVED> rhs);
#endif

    /// Disengage this object if the specified `rhs` object is disengaged,
    /// and assign to this object the value of `rhs.value()` (of
    /// `t_ANY_TYPE`) converted to `t_TYPE` otherwise.  Return a reference
    /// providing modifiable access to this object.  Note that this method
    /// does not participate in overload resolution unless `t_TYPE` and
    /// `t_ANY_TYPE` are compatible.  This assignment operator can be called in
    /// constant expressions only when neither `t_TYPE` nor `t_ANY_TYPE` is
    /// allocator-aware.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE&)&
    operator=(const optional<t_ANY_TYPE>& rhs);

    /// Disengage this object if the specified `rhs` object is disengaged,
    /// and move assign to this object the value of `rhs.value()` (of
    /// `t_ANY_TYPE`) converted to `t_TYPE` otherwise.  Return a reference
    /// providing modifiable access to this object.  Note that this method
    /// does not participate in overload resolution unless `t_TYPE` and
    /// `t_ANY_TYPE` are compatible.  This assignment operator can be called in
    /// constant expressions only when neither `t_TYPE` nor `t_ANY_TYPE` is
    /// allocator-aware.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)&
    operator=(BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) rhs);

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
    /// Assign to this object the value of the specified `rhs` object
    /// converted to `t_TYPE`, and return a reference providing modifiable
    /// access to this object.  Note that this method may invoke assignment
    /// from `rhs`, or construction from `rhs`, depending on whether this
    /// object is engaged.  This assignment operator does not participate in
    /// overload resolution if `t_ANY_TYPE` is possibly cv-qualified
    /// `bsl::optional<t_TYPE>`.  Also note that an assignment of the form
    /// `o = {};`, where `o` is of type `optional`, will always assign to
    /// `o` the empty state, and never call this overload (see
    /// implementation notes).  This assignment operator can be called in
    /// constant expressions only when `t_TYPE` is not allocator-aware.
    template <class t_ANY_TYPE = t_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_FORWARD_REF(t_TYPE, t_ANY_TYPE)&
    operator=(t_ANY_TYPE&& rhs);
#else
    // The existence of MovableRef in C++11 affects the above functions, and
    // they need to be defined in terms of rvalue references and perfect
    // forwarding.  For C++03, the MovableRef overloads are provided below.

    /// Assign to this object the value of the specified `rhs`, and return a
    /// reference providing modifiable access to this object.
    optional& operator=(const t_TYPE& rhs);

    /// Assign to this object the value of the specified `rhs`, and return a
    /// reference providing modifiable access to this object.  The contents
    /// of `rhs` are either move-constructed into or move-assigned to this
    /// object.  `rhs` is left in a valid but unspecified state.
    optional& operator=(BloombergLP::bslmf::MovableRef<t_TYPE> rhs);

    /// Assign to this object the value of the specified `rhs` object (of
    /// `ANY_TYPE`) converted to `TYPE`, and return a reference providing
    /// modifiable access to this object.  Note that this method may invoke
    /// assignment from `rhs`, or construction from `rhs`, depending on
    /// whether this `optional` object is engaged.
    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(t_TYPE, t_ANY_TYPE)&
    operator=(const t_ANY_TYPE& rhs);

    template <class t_ANY_TYPE>
    BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(t_TYPE, t_ANY_TYPE)&
    operator=(BloombergLP::bslmf::MovableRef<t_ANY_TYPE> rhs);
#endif  // RVALUES else

#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
    /// Disengage this object if the specified `rhs` object is disengaged,
    /// and assign to this object the value of `rhs.value()` (of
    /// `t_ANY_TYPE`) converted to `t_TYPE` otherwise.  Return a reference
    /// providing modifiable access to this object.  Note that this method
    /// does not participate in overload resolution unless `t_TYPE` and
    /// `t_ANY_TYPE` are compatible.  This assignment operator can be called in
    /// constant expressions only when `t_TYPE` is not allocator-aware.
    template <class t_ANY_TYPE = t_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(t_TYPE, const t_ANY_TYPE&)&
    operator=(const std::optional<t_ANY_TYPE>& rhs);

    /// Disengage this object if the specified `rhs` object is disengaged,
    /// and move assign to this object the value of `rhs.value()` (of
    /// `t_ANY_TYPE`) converted to `t_TYPE` otherwise.  Return a reference
    /// providing modifiable access to this object.  Note that this method
    /// does not participate in overload resolution unless `t_TYPE` and
    /// `t_ANY_TYPE` are compatible.  This assignment operator can be called in
    /// constant expressions only when `t_TYPE` is not allocator-aware.
    template <class t_ANY_TYPE = t_TYPE>
    BSLSTL_OPTIONAL_CONSTEXPR20
    BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(t_TYPE, t_ANY_TYPE)&
    operator=(std::optional<t_ANY_TYPE>&& rhs);
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
 
    // This macro indicates that `bsl::optional` provides `and_then`,
    // `or_else`, and `transform` methods.
    #define BSLSTL_OPTIONAL_PROVIDES_MONADICS

    /// If this object contains a value, invoke the specified `func` with the
    /// contained value as an argument and return `optional<U>` that contains
    /// the result of that invocation, where `U` is the cv-unqualified `func`
    /// return type, which can be different from `t_TYPE`; otherwise, return an
    /// empty `optional<U>`.  Note that `func` must return an object type other
    /// than array, `bsl::in_place_t` or `bsl::nullopt`.  Also note that there
    /// is no requirement that `U` is movable.  Finally note that the returned
    /// optional uses the allocator of the object returned by `func`, or the
    /// default allocator if `func` is not invoked.
    template <class t_FUNC> constexpr auto transform(t_FUNC&& func) &;
    template <class t_FUNC> constexpr auto transform(t_FUNC&& func) &&;
    template <class t_FUNC> constexpr auto transform(t_FUNC&& func) const &;
    template <class t_FUNC> constexpr auto transform(t_FUNC&& func) const &&;

    /// If this object contains a value, invoke the specified `func` with the
    /// contained value as an argument and return the result of that
    /// invocation; otherwise, return an empty optional.  Note that `func` must
    /// return a specialization of `bsl::optional`.  Also note that the return
    /// type of `func` does not have to be this object type.  Also note that
    /// the optional object returned by `func` is returned as-is, without
    /// copying or moving.  Finally note that the default allocator is used for
    /// constructing the empty optional when `func` is not invoked.
    template <class t_FUNC> constexpr auto and_then(t_FUNC&& func) &;
    template <class t_FUNC> constexpr auto and_then(t_FUNC&& func) &&;
    template <class t_FUNC> constexpr auto and_then(t_FUNC&& func) const &;
    template <class t_FUNC> constexpr auto and_then(t_FUNC&& func) const &&;

    /// If this object does not contain a value, invoke the specified `func`
    /// and return the result of that invocation.  Otherwise return a
    /// copy-constructed value from this object.  Note that `func` must return
    /// `bsl::optional`.  Also note that the optional object returned by `func`
    /// is returned as-is, without copying or moving.
    template <class t_FUNC>
    constexpr
    enable_if_t<conjunction_v<std::is_invocable<t_FUNC>,
                              std::is_copy_constructible<t_TYPE>>,
                optional> or_else(t_FUNC&& func) const &;

    /// If this object does not contain a value, invoke the specified `func`
    /// and return the result of that invocation; otherwise, return a
    /// move-constructed value from this object, leaving this object in an
    /// unspecified but valid state.  Note that `func` must return
    /// `bsl::optional`.  Also note that the optional object returned by `func`
    /// is returned as-is, without copying or moving.
    template <class t_FUNC>
    constexpr
    enable_if_t<conjunction_v<std::is_invocable<t_FUNC>,
                              std::is_move_constructible<t_TYPE>>,
                optional> or_else(t_FUNC&& func) &&;
#endif
};

}  // close namespace bsl

// ============================================================================
//         Section: Type Traits on Allocator-Unaware 'Optional_Base'
// ============================================================================

namespace BloombergLP {
namespace bslma {

template <class t_TYPE>
struct UsesBslmaAllocator<bslstl::Optional_Base<t_TYPE, false> >
: bsl::false_type {
};

template <class t_TYPE>
struct UsesBslmaAllocator<bsl::optional<t_TYPE> >
: UsesBslmaAllocator<t_TYPE> {
};

}  // close namespace bslma
}  // close enterprise namespace

namespace bsl {

// ============================================================================
//                          Section: CTAD Constructors
// ============================================================================

# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
// CLASS TEMPLATE DEDUCTION GUIDES

/// Deduce the specified type `t_TYPE` from the corresponding type supplied
/// to the constructor of `optional`.
template <class t_TYPE>
optional(t_TYPE) -> optional<t_TYPE>;

/// Deduce the specified type `t_TYPE` from the corresponding type supplied
/// to the constructor of `optional`.   This guide does not participate in
/// deduction unless the deduced type `t_TYPE` supports the bslma allocator
/// model, and the specified `t_ALLOC` can be implicitly converted to
/// `bsl::allocator<char>`.
template <class t_TYPE,
          class t_ALLOC,
          class = typename bsl::enable_if_t<
                    BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>,
          class = typename bsl::enable_if_t<
                bsl::is_convertible_v<t_ALLOC, bsl::allocator<char>>>
          >
optional(bsl::allocator_arg_t, t_ALLOC, t_TYPE)
-> optional<t_TYPE>;

/// Deduce the specified type `t_TYPE` from the corresponding template
/// parameter type supplied to the constructor of `optional`.   This guide
/// does not participate in deduction unless the deduced type `t_TYPE`
/// supports the bslma allocator model, and the specified `t_ALLOC` can be
/// implicitly converted to `bsl::allocator<char>`.
template <class t_TYPE,
          class t_ALLOC,
          class = typename bsl::enable_if_t<
                    BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>,
          class = typename bsl::enable_if_t<
                bsl::is_convertible_v<t_ALLOC, bsl::allocator<char>>>
          >
optional(bsl::allocator_arg_t, t_ALLOC, optional<t_TYPE>)
-> optional<t_TYPE>;
# endif  // BSLS_COMPILERFEATURES_SUPPORT_CTAD

// ============================================================================
//                      Section: Free Function Declarations
// ============================================================================

// FREE FUNCTIONS

/// Efficiently exchange the values of the specified `lhs` and `rhs`
/// objects.  This method provides the no-throw exception-safety guarantee
/// if the template parameter `t_TYPE` provides that guarantee, `lhs` and
/// `rhs` have equal allocators, and `lhs.hasValue() == rhs.hasValue()`.
template <class t_TYPE>
typename bsl::enable_if<BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value,
                        void>::type
swap(bsl::optional<t_TYPE>& lhs, bsl::optional<t_TYPE>& rhs);

/// Efficiently exchange the values of the specified `lhs` and `rhs`
/// objects.  This method provides the no-throw exception-safety guarantee
/// if the template parameter `t_TYPE` provides that guarantee and the
/// result of the `hasValue` method for `lhs` and `rhs` is the same.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
typename bsl::enable_if<!BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value,
                        void>::type
swap(bsl::optional<t_TYPE>& lhs, bsl::optional<t_TYPE>& rhs);

// HASH SPECIALIZATIONS

/// Pass the specified `input` to the specified `hashAlg`, where `hashAlg`
/// is a hashing algorithm.
template <class t_HASHALG, class t_TYPE>
void hashAppend(t_HASHALG& hashAlg, const optional<t_TYPE>& input);

// FREE OPERATORS

/// Return `true` if the specified `lhs` and `rhs` `optional` objects have the
/// same value, and `false` otherwise.  Two `optional` objects have the same
/// value if both are disengaged, or if both are engaged and the values of
/// their underlying objects compare equal.  This function can be called in
/// constant expressions only if neither `t_LHS_TYPE` nor `t_RHS_TYPE` is
/// allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator==(const bsl::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` and `rhs` `optional` objects do not
/// have the same value, and `false` otherwise.  Two `optional` objects do
/// not have the same value if one is disengaged and the other is engaged,
/// or if both are engaged and the values of their underlying objects do not
/// compare equal.  This function can be called in constant expressions only if
/// neither `t_LHS_TYPE` nor `t_RHS_TYPE` is allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator!=(const bsl::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` `optional` object is ordered before
/// the specified `rhs` `optional` object, and `false` otherwise.  `lhs` is
/// ordered before `rhs` if `lhs` is disengaged and `rhs` is engaged or if
/// both are engaged and `lhs.value()` is ordered before `rhs.value()`.  This
/// function can be called in constant expressions only if neither `t_LHS_TYPE`
/// nor `t_RHS_TYPE` is allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<(const bsl::optional<t_LHS_TYPE>& lhs,
               const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` `optional` object is ordered after
/// the specified `rhs` `optional` object, and `false` otherwise.  `lhs` is
/// ordered after `rhs` if `lhs` is engaged and `rhs` is disengaged or if
/// both are engaged and `lhs.value()` is ordered after `rhs.value()`.  This
/// function can be called in constant expressions only if neither `t_LHS_TYPE`
/// nor `t_RHS_TYPE` is allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>(const bsl::optional<t_LHS_TYPE>& lhs,
               const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` `optional` object is ordered before
/// the specified `rhs` `optional` object or if `lhs` and `rhs` have the
/// same value, and `false` otherwise.  (See `operator<` and `operator==`.)
/// This function can be called in constant expressions only if neither
/// `t_LHS_TYPE` nor `t_RHS_TYPE` is allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<=(const bsl::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` `optional` object is ordered after
/// the specified `rhs` `optional` object or if `lhs` and `rhs` have the
/// same value, and `false` otherwise.  (See `operator>` and `operator==`.)
/// This function can be called in constant expressions only if neither
/// `t_LHS_TYPE` nor `t_RHS_TYPE` is allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>=(const bsl::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

// comparison with 'nullopt_t'

/// Return `true` if the specified `value` is disengaged, and `false`
/// otherwise.  This function can be called in constant expressions only if
/// `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator==(const bsl::optional<t_TYPE>& value,
                const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT;
#if !(defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) &&          \
      defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS))
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator==(const bsl::nullopt_t&,
                const bsl::optional<t_TYPE>& value) BSLS_KEYWORD_NOEXCEPT;

/// Return `true` if the specified `value` is engaged, and `false` otherwise.
/// These functions can be called in constant expressions only if `t_TYPE` is
/// not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator!=(const bsl::optional<t_TYPE>& value,
                const bsl::nullopt_t&)       BSLS_KEYWORD_NOEXCEPT;
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator!=(const bsl::nullopt_t&,
                const bsl::optional<t_TYPE>& value) BSLS_KEYWORD_NOEXCEPT;

/// Return `false`.  Note that `bsl::nullopt_t` never orders after a
/// `bsl::optional`.  This function can be called in constant expressions only
/// if `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<(const bsl::optional<t_TYPE>&,
               const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT;

/// Return `true` if the specified `value` is engaged, and `false` otherwise.
/// Note that `bsl::nullopt_t` is ordered before any `bsl::optional` that is
/// engaged.  This function can be called in constant expressions only if
/// `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<(const bsl::nullopt_t&,
               const bsl::optional<t_TYPE>& value) BSLS_KEYWORD_NOEXCEPT;

/// Return `true` if the specified `value` is engaged, and `false` otherwise.
/// This function can be called in constant expressions only if `t_TYPE` is not
/// allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>(const bsl::optional<t_TYPE>& value,
               const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT;

/// Return `false`.  Note that `bsl::nullopt_t` never orders after a
/// `bsl::optional`.  This function can be called in constant expressions only
/// if `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>(const bsl::nullopt_t&,
               const bsl::optional<t_TYPE>&) BSLS_KEYWORD_NOEXCEPT;

/// Return `true` if the specified `value` is disengaged, and `false`
/// otherwise.  This function can be called in constant expressions only if
/// `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<=(const bsl::optional<t_TYPE>& value,
                const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT;

/// Return `true`.  Note that `bsl::nullopt_t` is ordered before any
/// `bsl::optional` that is engaged.  This function can be called in constant
/// expressions only if `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<=(const bsl::nullopt_t&,
                const bsl::optional<t_TYPE>&) BSLS_KEYWORD_NOEXCEPT;

/// Return `true`.  Note that `bsl::nullopt_t` is ordered before any
/// `bsl::optional` that is engaged.  This function can be called in constant
/// expressions only if `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>=(const bsl::optional<t_TYPE>&,
                const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT;

/// Return `true` if the specified `value` is disengaged, and `false`
/// otherwise.  This function can be called in constant expressions only if
/// `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>=(const bsl::nullopt_t&,
                const bsl::optional<t_TYPE>& value) BSLS_KEYWORD_NOEXCEPT;
#endif  // !(defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) &&
        //   defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS))

// comparison with 'value_type'

/// Return `true` if the specified `lhs` and `rhs` objects have the same
/// value, and `false` otherwise.  An `optional` object and a value of some
/// type have the same value if the optional object is engaged and its
/// underlying value compares equal to the other value.  These functions can be
/// called in constant expressions only if the `optional`'s value type is not
/// allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator==(const bsl::optional<t_LHS_TYPE>& lhs,
                const t_RHS_TYPE&                rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs == rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator==(const t_LHS_TYPE&                lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

/// Return `true` if the specified `lhs` and `rhs` objects do not have the same
/// value, and `false` otherwise.  An `optional` object and a value of some
/// type do not have the same value if either the optional object is
/// disengaged, or its underlying value does not compare equal to the other
/// value.  These function can be called in constant expressions only if the
/// `optional`'s value type is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator!=(const bsl::optional<t_LHS_TYPE>& lhs,
                const t_RHS_TYPE&                rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs != rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator!=(const t_LHS_TYPE&                lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

/// Return `true` if the specified `lhs` `optional` object is ordered before
/// the specified `rhs`, and `false` otherwise.  `lhs` is ordered before
/// `rhs` if `lhs` is disengaged or `lhs.value()` is ordered before `rhs`.
/// This function can be called in constant expressions only if `t_LHS_TYPE`
/// is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs < rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

/// Return `true` if the specified `lhs` is ordered before the specified `rhs`
/// `optional` object, and `false` otherwise.  `lhs` is ordered before `rhs` if
/// `rhs` is engaged and `lhs` is ordered before `rhs.value()`.  This function
/// can be called in constant expressions only if `t_RHS_TYPE` is not
/// allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

/// Return `true` if the specified `lhs` `optional` object is ordered after the
/// specified `rhs`, and `false` otherwise.  `lhs` is ordered after `rhs` if
/// `lhs` is engaged and `lhs.value()` is ordered after `rhs`.  This function
/// can be called in constant expressions only if `t_LHS_TYPE` is not
/// allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs > rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

/// Return `true` if the specified `lhs` is ordered after the specified `rhs`
/// `optional` object, and `false` otherwise.  `lhs` is ordered after `rhs` if
/// `rhs` is disengaged or `lhs` is ordered after `rhs.value()`.  This
/// function can be called in constant expressions only if `t_RHS_TYPE` is not
/// allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

/// Return `true` if the specified `lhs` `optional` object is ordered before
/// the specified `rhs` or `lhs` and `rhs` have the same value, and `false`
/// otherwise.  (See `operator<` and `operator==`.)  This function can be
/// called in constant expressions only if `t_LHS_TYPE` is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs <= rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

/// Return `true` if the specified `lhs` is ordered before the specified `rhs`
/// `optional` object or `lhs` and `rhs` have the same value, and `false`
/// otherwise.  (See `operator<` and `operator==`.)  This function can be
/// called in constant expressions only if `t_RHS_TYPE` is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

/// Return `true` if the specified `lhs` `optional` object is ordered after the
/// specified `rhs` or if `lhs` and `rhs` have the same value, and `false`
/// otherwise.  (See `operator>` and `operator==`.)  This function can be
/// called in constant expressions only if `t_LHS_TYPE` is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs >= rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

// Return `true` if the specified `lhs` is ordered after the specified `rhs`
// `optional` object or if `lhs` and `rhs` have the same value, or `false`
// otherwise.  (See `operator>` and `operator==`.)  This function can be
/// called in constant expressions only if `t_LHS_TYPE` is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        });

#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
/// Perform a three-way comparison of the specified `lhs` and the specified
/// `rhs` objects by using the comparison operators of `t_LHS` and `t_RHS`;
/// return the result of that comparison.  This function can be called in
/// constant expressions only if neither `t_LHS` nor `t_RHS` is
/// allocator-aware.
template <class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
BSLSTL_OPTIONAL_CONSTEXPR20
compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
                                              const bsl::optional<t_LHS>& lhs,
                                              const bsl::optional<t_RHS>& rhs);

/// Perform a three-way comparison of the specified `lhs` and the specified
/// `rhs` objects by using the comparison operators of `t_LHS` and `t_RHS`;
/// return the result of that comparison.  This function can be called in
/// constant expressions only if `t_LHS` is not allocator-aware.
template <class t_LHS, class t_RHS>
requires (!BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS>) &&
         three_way_comparable_with<t_LHS, t_RHS>
BSLSTL_OPTIONAL_CONSTEXPR20
compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
                                              const bsl::optional<t_LHS>& lhs,
                                              const t_RHS&                rhs);

/// Perform a three-way comparison of the specified `value` and `nullopt`;
/// return the result of that comparison.  This function can be called in
/// constant expressions only if `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
strong_ordering operator<=>(const bsl::optional<t_TYPE>& value,
                            bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT;

/// Perform a three-way comparison of the specified `lhs` and the specified
/// `rhs` objects by using the comparison operators of `t_LHS` and `t_RHS`;
/// return the result of that comparison.  This function can be called in
/// constant expressions only if `t_LHS` is not allocator-aware.
template <class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
BSLSTL_OPTIONAL_CONSTEXPR20
compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
                                              const bsl::optional<t_LHS>& lhs,
                                              const std::optional<t_RHS>& rhs);
#endif

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
/// Efficiently exchange the values of the specified `lhs` and `rhs`
/// objects.  This method provides the no-throw exception-safety guarantee
/// if the template parameter `t_TYPE` provides that guarantee and the
/// result of the `hasValue` method for `lhs` and `rhs` is the same.  This
/// function can be called in constant expressions only if `t_TYPE` is not
/// allocator-aware.
template <class t_TYPE>
typename bsl::enable_if<!BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value,
                        void>::type
swap(bsl::optional<t_TYPE>& lhs, std::optional<t_TYPE>& rhs);
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
typename bsl::enable_if<!BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value,
                        void>::type
swap(std::optional<t_TYPE>& lhs, bsl::optional<t_TYPE>& rhs);

// comparison with 'std::optional'

/// Return `true` if the specified `lhs` and `rhs` optional objects have the
/// same value, and `false` otherwise.  Two optional objects have the same
/// value if both are disengaged, or if both are engaged and the values of
/// their underlying objects compare equal.  Note that this function will
/// fail to compile if `t_LHS_TYPE` and `t_RHS_TYPE` are not compatible.
/// These functions can be called in constant expressions only if the
/// `bsl::optional`'s value type is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator==(const std::optional<t_LHS_TYPE>& lhs,
                          const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator==(const bsl::optional<t_LHS_TYPE>& lhs,
                          const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` and `rhs` optional objects do not
/// have the same value, and `false` otherwise.  Two optional objects do not
/// have the same value if one is disengaged and the other is engaged, or if
/// both are engaged and the values of their underlying objects do not
/// compare equal.  Note that this function will fail to compile if
/// `t_LHS_TYPE` and `t_RHS_TYPE` are not compatible.  These functions can be
/// called in constant expressions only if the `bsl::optional`'s value type is
/// not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator!=(const bsl::optional<t_LHS_TYPE>& lhs,
                          const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator!=(const std::optional<t_LHS_TYPE>& lhs,
                          const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` optional object is ordered before
/// the specified `rhs` optional object, and `false` otherwise.  `lhs` is
/// ordered before `rhs` if `lhs` is disengaged and `rhs` is engaged or if
/// both are engaged and `lhs.value()` is ordered before `rhs.value()`.
/// Note that this function will fail to compile if `t_LHS_TYPE` and
/// `t_RHS_TYPE` are not compatible.  These functions can be called in
/// constant expressions only if the `bsl::optional`'s value type is not
/// allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator<(const bsl::optional<t_LHS_TYPE>& lhs,
                         const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator<(const std::optional<t_LHS_TYPE>& lhs,
                         const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` optional object is ordered after
/// the specified `rhs` optional object, and `false` otherwise.  `lhs` is
/// ordered after `rhs` if `lhs` is engaged and `rhs` is disengaged or if
/// both are engaged and `lhs.value()` is ordered after `rhs.value()`.  Note
/// that this function will fail to compile if `t_LHS_TYPE` and `t_RHS_TYPE`
/// are not compatible.  These functions can be called in constant expressions
/// only if the `bsl::optional`'s value type is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator>(const bsl::optional<t_LHS_TYPE>& lhs,
                         const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator>(const std::optional<t_LHS_TYPE>& lhs,
                         const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` is ordered before the specified
/// `rhs` optional object or `lhs` and `rhs` have the same value, and
/// `false` otherwise.  (See `operator<` and `operator==`.)  Note that this
/// function will fail to compile if `t_LHS_TYPE` and `t_RHS_TYPE` are not
/// compatible.  These functions can be called in constant expressions only if
/// the `bsl::optional`'s value type is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator<=(const bsl::optional<t_LHS_TYPE>& lhs,
                          const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator<=(const std::optional<t_LHS_TYPE>& lhs,
                          const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });

/// Return `true` if the specified `lhs` optional object is ordered after
/// the specified `rhs` optional object or `lhs` and `rhs` have the same
/// value, and `false` otherwise.  (See `operator>` and `operator==`.)  Note
/// that this function will fail to compile if `t_LHS_TYPE` and `t_RHS_TYPE`
/// are not compatible.  These functions can be called in constant expressions
/// only if the `bsl::optional`'s value type is not allocator-aware.
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator>=(const bsl::optional<t_LHS_TYPE>& lhs,
                          const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });
template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr bool operator>=(const std::optional<t_LHS_TYPE>& lhs,
                          const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    });
#endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

/// Return an `optional` object containing a `t_TYPE` object created by
/// invoking a `bsl::optional` allocator-extended `in_place_t` constructor
/// with the specified `alloc` as the allocator argument, and specified
/// `rhs` as the constructor argument.  Note that this function will fail to
/// compile if `t_TYPE` doesn't use allocators.
template <class t_TYPE>
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);

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_J
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_J BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0
template <class t_TYPE>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1
template <class t_TYPE, class t_ARGS_01>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06,
                        class t_ARGS_07>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06,
                        class t_ARGS_07,
                        class t_ARGS_08>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06,
                        class t_ARGS_07,
                        class t_ARGS_08,
                        class t_ARGS_09>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06,
                        class t_ARGS_07,
                        class t_ARGS_08,
                        class t_ARGS_09,
                        class t_ARGS_10>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0
template <class t_TYPE, class t_INIT_LIST_TYPE>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08,
                                                class t_ARGS_09>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08,
                                                class t_ARGS_09,
                                                class t_ARGS_10>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_J >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE, class... t_ARGS>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...          args);

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE, class t_INIT_LIST_TYPE, class... t_ARGS>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...          args);
#  endif
// }}} END GENERATED CODE
#endif

/// Return an `optional` object containing a `t_TYPE` object created by
/// invoking a `bsl::optional` constructor with the specified `rhs` as the
/// constructor argument.  If `t_TYPE` uses an allocator, the default
/// allocator will be used for the `optional` object.  This function can be
/// called in constant expressions only if `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<typename bsl::decay<t_TYPE>::type>
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) rhs);

/// Return an `optional` object containing a value-initialized `t_TYPE`
/// object.  If `t_TYPE` uses an allocator, the default allocator will be
/// used for the `optional` object.  This function can be called in constant
/// expressions only if `t_TYPE` is not allocator-aware.
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE> make_optional();

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_K
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_K BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0
template <class t_TYPE, class t_ARG>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1
template <class t_TYPE, class t_ARG, class t_ARGS_01>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06,
                                     class t_ARGS_07>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06,
                                     class t_ARGS_07,
                                     class t_ARGS_08>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06,
                                     class t_ARGS_07,
                                     class t_ARGS_08,
                                     class t_ARGS_09>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06,
                                     class t_ARGS_07,
                                     class t_ARGS_08,
                                     class t_ARGS_09,
                                     class t_ARGS_10>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0
template <class t_TYPE, class t_INIT_LIST_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08,
                                                class t_ARGS_09>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08,
                                                class t_ARGS_09,
                                                class t_ARGS_10>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10);
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_K >= 10


#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE, class t_ARG, class... t_ARGS>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE, class t_INIT_LIST_TYPE, class... t_ARGS>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args);

#  endif
// }}} END GENERATED CODE
#endif

}  // close namespace bsl

// ============================================================================
//                           INLINE DEFINITIONS
// ============================================================================

namespace BloombergLP {
namespace bslstl {

// ============================================================================
//                  Section: bslstl::Optional_* Definitions
// ============================================================================

                           // ======================
                           // class Optional_DataImp
                           // ======================

// CREATORS
template <class t_TYPE>
Optional_DataImp<t_TYPE>::Optional_DataImp() BSLS_KEYWORD_NOEXCEPT
: d_hasValue(false)
{
}

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
template <class t_TYPE>
template <class t_INVOCABLE, class t_ARG>
inline
Optional_DataImp<t_TYPE>::Optional_DataImp(
                                       Optional_InvokeConstructorTag ,
                                       t_INVOCABLE&&                 invocable,
                                       t_ARG&&                       arg)
: d_hasValue(false)
{
    // Direct non-list initialization is mandated here
    ::new((void*)d_buffer.address()) t_TYPE(
                              std::invoke(std::forward<t_INVOCABLE>(invocable),
                                          std::forward<t_ARG>(arg)));
    d_hasValue = true;
}
#endif

// MANIPULATORS
#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_L
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_L BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0
template <class t_TYPE>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator);
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1
template <class t_TYPE>
template <class t_ARGS_01>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0
template <class t_TYPE>
template <class t_INIT_LIST_TYPE>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il);
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
    d_hasValue = true;
    return d_buffer.object();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_L >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE>
template <class... t_ARGS>
inline
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...  args)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
    d_hasValue = true;
    return d_buffer.object();
}

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
t_TYPE& Optional_DataImp<t_TYPE>::emplace(
                       bslma::Allocator                             *allocator,
                       std::initializer_list<t_INIT_LIST_TYPE>       il,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...  args)
{
    reset();
    BloombergLP::bslma::ConstructionUtil::construct(
        d_buffer.address(),
        allocator,
        il,
        BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
    d_hasValue = true;
    return d_buffer.object();
}
#  endif
// }}} END GENERATED CODE
#endif

template <class t_TYPE>
void Optional_DataImp<t_TYPE>::reset() BSLS_KEYWORD_NOEXCEPT
{
    if (d_hasValue) {
      d_hasValue = false;
      bslma::DestructionUtil::destroy(d_buffer.address());
    }
}

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
t_TYPE& Optional_DataImp<t_TYPE>::value() &
{
    // We do not assert on an empty object in this function as the assert level
    // is determined by the 'Optional_Base' method invoking 'value()'

    return d_buffer.object();
}

template <class t_TYPE>
inline
t_TYPE&& Optional_DataImp<t_TYPE>::value() &&
{
    // We do not assert on an empty object in this function as the assert level
    // is determined by the 'Optional_Base' method invoking 'value()'

    return std::move(d_buffer.object());
}
# else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
t_TYPE& Optional_DataImp<t_TYPE>::value()
{
    // We do not assert on an empty object in this function as the assert level
    // is determined by the 'Optional_Base' method invoking 'value()'

    return d_buffer.object();
}
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

// ACCESSORS
template <class t_TYPE>
inline
bool Optional_DataImp<t_TYPE>::hasValue() const BSLS_KEYWORD_NOEXCEPT
{
#ifdef BSLS_PLATFORM_CMP_GNU
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Warray-bounds"
#endif
    return d_hasValue;
#ifdef BSLS_PLATFORM_CMP_GNU
# pragma GCC diagnostic pop
#endif
}

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
const t_TYPE& Optional_DataImp<t_TYPE>::value() const&
{
    // We do not assert on an empty object in this function as the assert level
    // is determined by the 'Optional_Base' method invoking 'value()'

    return d_buffer.object();
}

template <class t_TYPE>
inline
const t_TYPE&& Optional_DataImp<t_TYPE>::value() const&&
{
    // We do not assert on an empty object in this function as the assert level
    // is determined by the 'Optional_Base' method invoking 'value()'

    return std::move(d_buffer.object());
}
# else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
const t_TYPE& Optional_DataImp<t_TYPE>::value() const
{
    // We do not assert on an empty object in this function as the assert level
    // is determined by the 'Optional_Base' method invoking 'value()'

    return d_buffer.object();
}
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

                            // ===================
                            // class Optional_Data
                            // ===================

// CREATORS
template <class t_TYPE, bool t_IS_TRIVIALLY_DESTRUCTIBLE>
Optional_Data<t_TYPE, t_IS_TRIVIALLY_DESTRUCTIBLE>::~Optional_Data()
{
    this->reset();
}

// ============================================================================
//        Section: Allocator-Aware 'Optional_Base' Method Definitions
// ============================================================================

                            // ===================
                            // class Optional_Base
                            // ===================

// PROTECTED CREATORS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base()
{
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(bsl::nullopt_t)
{
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                                                 const Optional_Base& original)
{
    if (original.has_value()) {
        emplace(*original);
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                        BloombergLP::bslmf::MovableRef<Optional_Base> original)
    BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                             bsl::is_nothrow_move_constructible<t_TYPE>::value)
: d_allocator(MoveUtil::access(original).get_allocator())
{
    Optional_Base& lvalue = original;

    if (lvalue.has_value()) {
        emplace(MoveUtil::move(*lvalue));
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                         BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value));
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>& original)
{
    if (original.has_value()) {
        emplace(original.value());
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
  BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original,
  BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR(t_TYPE,
                                                                   t_ANY_TYPE))
{
    Optional_Base<t_ANY_TYPE>& lvalue = original;
    if (lvalue.has_value()) {
        emplace(MoveUtil::move(*lvalue));
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
          BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
          BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original,
          BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR(t_TYPE,
                                                                   t_ANY_TYPE))
: d_allocator(MoveUtil::access(original).get_allocator())
{
    Optional_Base<t_ANY_TYPE>& lvalue = original;
    if (lvalue.has_value()) {
        emplace(MoveUtil::move(*lvalue));
    }
}

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                    BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
                    const std::optional<t_ANY_TYPE>& original)
{
    if (original.has_value()) {
        emplace(original.value());
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                    BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
                    std::optional<t_ANY_TYPE>&& original)
{
    if (original.has_value()) {
        emplace(std::move(original.value()));
    }
}
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_M
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_M BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t)
{
    emplace();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il)
{
    emplace(il);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_M >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class... t_ARGS>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}
#  endif
// }}} END GENERATED CODE
#endif

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INVOCABLE, class t_ARG>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                                       Optional_InvokeConstructorTag tag,
                                       t_INVOCABLE&&                 invocable,
                                       t_ARG&&                       arg)
: d_value(tag, std::forward<t_INVOCABLE>(invocable), std::forward<t_ARG>(arg))
, d_allocator(bslma::AATypeUtil::getAllocatorFromSubobject<allocator_type>(
                                                              d_value.value()))
{
}
#endif

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                                                      bsl::allocator_arg_t,
                                                      allocator_type allocator)
: d_allocator(allocator)
{
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                                                      bsl::allocator_arg_t,
                                                      allocator_type allocator,
                                                      bsl::nullopt_t)
: d_allocator(allocator)
{
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                                                bsl::allocator_arg_t,
                                                allocator_type       allocator,
                                                const Optional_Base& original)
: d_allocator(allocator)
{
    if (original.has_value()) {
        emplace(*original);
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                       bsl::allocator_arg_t,
                       allocator_type                                allocator,
                       BloombergLP::bslmf::MovableRef<Optional_Base> original)
: d_allocator(allocator)
{
    Optional_Base& lvalue = original;

    if (lvalue.has_value()) {
        emplace(MoveUtil::move(*lvalue));
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                       bsl::allocator_arg_t,
                       allocator_type                                allocator,
                       BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                       BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
: d_allocator(allocator)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value));
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                  bsl::allocator_arg_t,
                  allocator_type                   allocator,
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>& original)
: d_allocator(allocator)
{
    if (original.has_value()) {
        emplace(original.value());
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                  bsl::allocator_arg_t,
                  allocator_type                                     allocator,
                  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original)
: d_allocator(allocator)
{
    Optional_Base<t_ANY_TYPE>& lvalue = original;
    if (lvalue.has_value()) {
        emplace(MoveUtil::move(*lvalue));
    }
}

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                    bsl::allocator_arg_t,
                    allocator_type                   allocator,
                    BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
                    const std::optional<t_ANY_TYPE>& original)
: d_allocator(allocator)
{
    if (original.has_value()) {
        emplace(original.value());
    }
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                    bsl::allocator_arg_t,
                    allocator_type              allocator,
                    BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
                    std::optional<t_ANY_TYPE>&& original)
: d_allocator(allocator)
{
    if (original.has_value()) {
        emplace(std::move(original.value()));
    }
}
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_N
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_N BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t)
: d_allocator(alloc)
{
    emplace();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il)
: d_allocator(alloc)
{
    emplace(il);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_N >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class... t_ARGS>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
: d_allocator(alloc)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::Optional_Base(
                            bsl::allocator_arg_t,
                            allocator_type                               alloc,
                            bsl::in_place_t,
                            std::initializer_list<t_INIT_LIST_TYPE>      il,
                            BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
: d_allocator(alloc)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}
#  endif
// }}} END GENERATED CODE
#endif

// PROTECTED MANIPULATORS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
void Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::assignOrEmplace(
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) rhs)
{
    if (has_value()) {
        d_value.value() = BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, rhs);
    } else {
        emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, rhs));
    }
}

# ifndef BDE_OMIT_INTERNAL_DEPRECATED
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::dereferenceRaw()
{
    // This method is provided for the purpose of allowing 'NullableValue' to
    // determine the assert level in its value() method.  Do not assert here.

    return d_value.value();
}

// PROTECTED ACCESORS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::dereferenceRaw() const
{
    // This method is provided for the purpose of allowing 'NullableValue' to
    // determine the assert level in its value() method.  Do not assert here.

    return d_value.value();
}
# endif  // BDE_OMIT_INTERNAL_DEPRECATED

// MANIPULATORS
#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_O
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_O BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             )
{
    return d_value.emplace(d_allocator.mechanism());
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_O >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class... t_ARGS>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    return d_value.emplace(d_allocator.mechanism(),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::emplace(
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    return d_value.emplace(d_allocator.mechanism(),
                           il,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}
#  endif
// }}} END GENERATED CODE
#endif

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
void Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::reset() BSLS_KEYWORD_NOEXCEPT
{
    d_value.reset();
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
void Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::swap(Optional_Base& other)
    BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                           bsl::is_nothrow_move_constructible<t_TYPE>::value &&
                           bsl::is_nothrow_swappable<t_TYPE>::value)
{
    BSLS_ASSERT(d_allocator == other.d_allocator);

    if (this->has_value() && other.has_value()) {
        BloombergLP::bslalg::SwapUtil::swap(
                                          BSLS_UTIL_ADDRESSOF(d_value.value()),
                                          BSLS_UTIL_ADDRESSOF(*other));
    }
    else if (this->has_value()) {
        other.emplace(MoveUtil::move(d_value.value()));
        this->reset();
    }
    else if (other.has_value()) {
        this->emplace(MoveUtil::move(*other));
        other.reset();
    }
}

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() &
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return d_value.value();
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() &&
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return std::move(d_value.value());
}

# else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value()
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return d_value.value();
}

# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
                                                         t_ANY_TYPE&& value) &&
{
    if (has_value()) {
        return t_TYPE(std::move(d_value.value()));                    // RETURN
    }
    else {
        return t_TYPE(std::forward<t_ANY_TYPE>(value));               // RETURN
    }
}

#  ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
                                                      bsl::allocator_arg_t,
                                                      allocator_type allocator,
                                                      t_ANY_TYPE&&   value) &&
{
    if (has_value()) {
        return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
                                        allocator,
                                        std::move(d_value.value()));  // RETURN
    }
    else {
        return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
                                   allocator,
                                   std::forward<t_ANY_TYPE>(value));  // RETURN
    }
}
#  endif  // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>&
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator=(const Optional_Base& rhs)
{
    if (rhs.has_value()) {
        if (this->has_value()) {
            d_value.value() = *rhs;
        }
        else {
            emplace(*rhs);
        }
    }
    else {
        reset();
    }
    return *this;
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>&
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator=(
                             BloombergLP::bslmf::MovableRef<Optional_Base> rhs)
{
    Optional_Base& lvalue = rhs;

    if (lvalue.has_value()) {
        if (this->has_value()) {
            d_value.value() = MoveUtil::move(*lvalue);
        }
        else {
            emplace(MoveUtil::move(*lvalue));
        }
    }
    else {
        reset();
    }
    return *this;
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
t_TYPE *Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator->()
{
    BSLS_ASSERT(has_value());

    return BSLS_UTIL_ADDRESSOF(d_value.value());
}

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() &
{
    BSLS_ASSERT(has_value());

    return d_value.value();
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() &&
{
    BSLS_ASSERT(has_value());

    return std::move(d_value.value());
}

# else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*()
{
   BSLS_ASSERT(has_value());

   return d_value.value();
}

# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

// ACCESSORS

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
typename Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::allocator_type
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::get_allocator() const
                                                          BSLS_KEYWORD_NOEXCEPT
{
    return d_allocator;
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
bool
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::has_value() const
                                                          BSLS_KEYWORD_NOEXCEPT
{
    return d_value.hasValue();
}

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() const&
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return d_value.value();
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
const t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() const&&
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return std::move(d_value.value());
}

# else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value() const
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return d_value.value();
}

# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&
{
    if (has_value()) {
        return t_TYPE(d_value.value());                               // RETURN
    }
    else {
        return t_TYPE(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE,
                                                    value));          // RETURN
    }
}

#  ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
                    bsl::allocator_arg_t,
                    allocator_type                                allocator,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const&
{
    if (has_value()) {
        return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
            allocator, d_value.value());                              // RETURN
    }
    else {
        return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
            allocator,
            BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value));        // RETURN
    }
}
#  endif  // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
# else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
                     BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const
{
    if (has_value()) {
        return t_TYPE(d_value.value());                               // RETURN
    }
    else {
        return t_TYPE(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE,
                                                    value));          // RETURN
    }
}

#  ifdef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
template <class t_ANY_TYPE>
inline
t_TYPE Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::value_or(
                     bsl::allocator_arg_t,
                     allocator_type                                allocator,
                     BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value) const
{
    if (has_value()) {
        return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
            allocator, d_value.value());                              // RETURN
    }
    else {
        return BloombergLP::bslma::ConstructionUtil::make<t_TYPE>(
            allocator,
            BSLS_COMPILERFEATURES_FORWARD(ANY_TYPE, value));          // RETURN
    }
}
#  endif  // BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
const t_TYPE *Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator->() const
{
    BSLS_ASSERT(has_value());

    return BSLS_UTIL_ADDRESSOF(d_value.value());
}

# ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() const&
{
    BSLS_ASSERT(has_value());

    return d_value.value();
}

template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
const t_TYPE&& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() const&&
{
    BSLS_ASSERT(has_value());

    return std::move(d_value.value());
}

# else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
inline
const t_TYPE& Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator*() const
{
    BSLS_ASSERT(has_value());

    return d_value.value();
}
# endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
template <class t_TYPE, bool t_USES_BSLMA_ALLOC>
Optional_Base<t_TYPE, t_USES_BSLMA_ALLOC>::operator bool() const
                                                          BSLS_KEYWORD_NOEXCEPT
{
    return has_value();
}
#endif  // BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT

// ============================================================================
//    Section: C++17 Allocator-Unaware 'Optional_Base' Method Definitions
// ============================================================================

                     // ==================================
                     // class Optional_Base<t_TYPE, false>
                     // ==================================

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
// PROTECTED CREATORS
template <class t_TYPE>
constexpr
Optional_Base<t_TYPE, false>::Optional_Base()
{
}

template <class t_TYPE>
constexpr
Optional_Base<t_TYPE, false>::Optional_Base(bsl::nullopt_t)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
constexpr
Optional_Base<t_TYPE, false>::Optional_Base(
                         BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                         t_ANY_TYPE&& value)
: StdOptionalBase(std::forward<t_ANY_TYPE>(value))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 inline
Optional_Base<t_TYPE, false>::Optional_Base(
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>& original)
{
    if (original.has_value()) {
        this->emplace(original.value());
    }
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 inline
Optional_Base<t_TYPE, false>::Optional_Base(
                  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  Optional_Base<t_ANY_TYPE>&& original)
{
    if (original.has_value()) {
        this->emplace(std::move(original.value()));
    }
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 inline
Optional_Base<t_TYPE, false>::Optional_Base(
                    BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
                    const std::optional<t_ANY_TYPE>& original)
: StdOptionalBase(original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 inline
Optional_Base<t_TYPE, false>::Optional_Base(
                    BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
                    std::optional<t_ANY_TYPE>&& original)
: StdOptionalBase(std::move(original))
{
}

template <class t_TYPE>
template <class... t_ARGS>
constexpr
Optional_Base<t_TYPE, false>::Optional_Base(bsl::in_place_t, t_ARGS&&... args)
: StdOptionalBase(bsl::in_place, std::forward<t_ARGS>(args)...)
{
}

template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
constexpr
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE> il,
                                  t_ARGS&&...                             args)
: StdOptionalBase(bsl::in_place, il, std::forward<t_ARGS>(args)...)
{
}

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
template <class t_TYPE>
template <class t_INVOCABLE, class t_ARG>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                       Optional_InvokeConstructorTag ,
                                       t_INVOCABLE&&                 invocable,
                                       t_ARG&&                       arg)
: StdOptionalBase(Optional_ImmovableHelper<t_TYPE, t_INVOCABLE, t_ARG>{
                                          std::forward<t_INVOCABLE>(invocable),
                                          std::forward<t_ARG>(arg)})
{
}
#endif

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t, AllocType)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t,
                                            AllocType,
                                            bsl::nullopt_t)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                         bsl::allocator_arg_t,
                         AllocType,
                         BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                         t_ANY_TYPE&&)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                  bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>&)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                  bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  Optional_Base<t_ANY_TYPE>&&)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                    bsl::allocator_arg_t,
                    AllocType,
                    BloombergLP::bslstl::Optional_CopyConstructFromStdOptional,
                    const std::optional<t_ANY_TYPE>&)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                    bsl::allocator_arg_t,
                    AllocType,
                    BloombergLP::bslstl::Optional_MoveConstructFromStdOptional,
                    std::optional<t_ANY_TYPE>&&)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class... t_ARGS>
inline
Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t,
                                            AllocType,
                                            bsl::in_place_t,
                                            t_ARGS&&...)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

// PROTECTED MANIPULATORS
template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
void Optional_Base<t_TYPE, false>::assignOrEmplace(t_ANY_TYPE&& rhs)
{
    StdOptionalBase::operator=(std::forward<t_ANY_TYPE>(rhs));
}

#  ifndef BDE_OMIT_INTERNAL_DEPRECATED
template <class t_TYPE>
t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw()
{
    // This method is provided for the purpose of allowing 'NullableValue' to
    // determine the assert level in its value() method.  Do not assert here.

    return this->operator*();

}

// PROTECTED ACCESSORS
template <class t_TYPE>
const t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw() const
{
    // This method is provided for the purpose of allowing 'NullableValue' to
    // determine the assert level in its value() method.  Do not assert here.

    return this->operator*();

}
#  endif  // BDE_OMIT_INTERNAL_DEPRECATED

# else  // BSLSTL_OPTIONAL_USES_STD_ALIASES

// ============================================================================
//  Section: Pre-C++17 Allocator-Unaware 'Optional_Base' Method Definitions
// ============================================================================

// PROTECTED CREATORS
template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base()
{
}

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(bsl::nullopt_t)
{
}

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(const Optional_Base& original)
{
    if (original.has_value()) {
        emplace(original.value());
    }
}

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                        BloombergLP::bslmf::MovableRef<Optional_Base> original)
         BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                             bsl::is_nothrow_move_constructible<t_TYPE>::value)
{
    Optional_Base& lvalue = original;

    if (lvalue.has_value()) {
        emplace(MoveUtil::move(*lvalue));
    }
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                         BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value));
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>& original)
{
    if (original.has_value()) {
        emplace(original.value());
    }
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>) original)
{
    Optional_Base<t_ANY_TYPE>& lvalue = original;
    if (lvalue.has_value()) {
        emplace(MoveUtil::move(*lvalue));
    }
}

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_P
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_P BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0
template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t)
{
    emplace();
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1
template <class t_TYPE>
template <class t_ARGS_01>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10


#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0
template <class t_TYPE>
template <class t_INIT_LIST_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il)
{
    emplace(il);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_P >= 10

#   endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE>
template <class... t_ARGS>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    emplace(BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}

#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                             bsl::in_place_t,
                             std::initializer_list<t_INIT_LIST_TYPE>      il,
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    emplace(il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}
#   endif
// }}} END GENERATED CODE
#endif

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t, AllocType)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t,
                                            AllocType,
                                            bsl::nullopt_t)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(bsl::allocator_arg_t,
                                            AllocType,
                                            const Optional_Base&)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                 bsl::allocator_arg_t,
                                 AllocType,
                                 BloombergLP::bslmf::MovableRef<Optional_Base>)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                         bsl::allocator_arg_t,
                         AllocType,
                         BloombergLP::bslstl::Optional_ConstructFromForwardRef,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                  bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional,
                  const Optional_Base<t_ANY_TYPE>&)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                  bsl::allocator_arg_t,
                  AllocType,
                  BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional,
                  BSLMF_MOVABLEREF_DEDUCE(Optional_Base<t_ANY_TYPE>))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0
template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1
template <class t_TYPE>
template <class t_ARGS_01>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10


#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0
template <class t_TYPE>
template <class t_INIT_LIST_TYPE>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09),
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10))
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_Q >= 10

#   endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE>
template <class... t_ARGS>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}

#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
inline
Optional_Base<t_TYPE, false>::Optional_Base(
                                  bsl::allocator_arg_t,
                                  AllocType,
                                  bsl::in_place_t,
                                  std::initializer_list<t_INIT_LIST_TYPE>,
                                  BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...)
{
    BSLS_ASSERT_INVOKE_NORETURN(
                         "Should not be called for non-allocator-aware types");
}
#   endif
// }}} END GENERATED CODE
#endif

// PROTECTED MANIPULATORS
template <class t_TYPE>
template <class t_ANY_TYPE>
void Optional_Base<t_TYPE, false>::assignOrEmplace(
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) rhs)
{
    if (has_value()) {
        d_value.value() = BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, rhs);
    } else {
        emplace(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, rhs));
    }
}

#  ifndef BDE_OMIT_INTERNAL_DEPRECATED
template <class t_TYPE>
t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw()
{
    // This method is provided for the purpose of allowing 'NullableValue' to
    // determine the assert level in its value() method.  Do not assert here.

    return d_value.value();

}

// PROTECTED ACCESORS
template <class t_TYPE>
const t_TYPE& Optional_Base<t_TYPE, false>::dereferenceRaw() const
{
    // This method is provided for the purpose of allowing 'NullableValue' to
    // determine the assert level in its value() method.  Do not assert here.

    return d_value.value();

}
#  endif  // BDE_OMIT_INTERNAL_DEPRECATED

// MANIPULATORS
#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_R
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_R BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0
template <class t_TYPE>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                             )
{
    return d_value.emplace(NULL);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1
template <class t_TYPE>
template <class t_ARGS_01>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10


#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0
template <class t_TYPE>
template <class t_INIT_LIST_TYPE>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il)
{
    return d_value.emplace(
        NULL, il);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                  BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_R >= 10

#   endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE>
template <class... t_ARGS>
inline
t_TYPE&
Optional_Base<t_TYPE, false>::emplace(
                             BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    return d_value.emplace(NULL,
                           BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}

#   if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
t_TYPE& Optional_Base<t_TYPE, false>::emplace(
    std::initializer_list<t_INIT_LIST_TYPE>      il,
    BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    return d_value.emplace(
        NULL, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}
#   endif
// }}} END GENERATED CODE
#endif

template <class t_TYPE>
inline
void Optional_Base<t_TYPE, false>::reset() BSLS_KEYWORD_NOEXCEPT
{
    d_value.reset();
}

template <class t_TYPE>
void Optional_Base<t_TYPE, false>::swap(Optional_Base& other)
    BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                           bsl::is_nothrow_move_constructible<t_TYPE>::value &&
                           bsl::is_nothrow_swappable<t_TYPE>::value)
{
    if (this->has_value() && other.has_value()) {
        BloombergLP::bslalg::SwapUtil::swap(
                                         BSLS_UTIL_ADDRESSOF(d_value.value()),
                                         BSLS_UTIL_ADDRESSOF(*other));
    }
    else if (this->has_value()) {
        other.emplace(MoveUtil::move(d_value.value()));
        this->reset();
    }
    else if (other.has_value()) {
        this->emplace(MoveUtil::move(*other));
        other.reset();
    }
}

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
t_TYPE& Optional_Base<t_TYPE, false>::value() &
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return d_value.value();
}
template <class t_TYPE>
inline
t_TYPE&&
Optional_Base<t_TYPE, false>::value() &&
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return std::move(d_value.value());
}

#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
t_TYPE& Optional_Base<t_TYPE, false>::value()
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return d_value.value();
}

#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
template <class t_ANY_TYPE>
inline
t_TYPE
Optional_Base<t_TYPE, false>::value_or(t_ANY_TYPE&& value) &&
{
    if (has_value()) {
        return t_TYPE(std::move(d_value.value()));                    // RETURN
    }
    else {
        return t_TYPE(std::forward<t_ANY_TYPE>(value));               // RETURN
    }
}
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>&
Optional_Base<t_TYPE, false>::operator=(const Optional_Base& rhs)
{
    if (rhs.has_value()) {
        if (this->has_value()) {
            d_value.value() = *rhs;
        }
        else {
            emplace(*rhs);
        }
    }
    else {
        reset();
    }
    return *this;
}

template <class t_TYPE>
inline
Optional_Base<t_TYPE, false>&
Optional_Base<t_TYPE, false>::operator=(
                             BloombergLP::bslmf::MovableRef<Optional_Base> rhs)
{
    Optional_Base& lvalue = rhs;
    if (lvalue.has_value()) {
        if (this->has_value()) {
            d_value.value() = MoveUtil::move(*lvalue);
        }
        else {
            emplace(MoveUtil::move(*lvalue));
        }
    }
    else {
        reset();
    }
    return *this;
}

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
t_TYPE& Optional_Base<t_TYPE, false>::operator*() &
{
    BSLS_ASSERT(has_value());

    return d_value.value();
}

template <class t_TYPE>
inline
t_TYPE&& Optional_Base<t_TYPE, false>::operator*() &&
{
    BSLS_ASSERT(has_value());

    return std::move(d_value.value());
}
#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
t_TYPE& Optional_Base<t_TYPE, false>::operator*()
{
    BSLS_ASSERT(has_value());

    return d_value.value();
}
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS

template <class t_TYPE>
inline
t_TYPE *Optional_Base<t_TYPE, false>::operator->()
{
    BSLS_ASSERT(has_value());

    return BSLS_UTIL_ADDRESSOF(d_value.value());
}

// ACCESSORS

template <class t_TYPE>
inline
bool Optional_Base<t_TYPE, false>::has_value() const BSLS_KEYWORD_NOEXCEPT
{
    return d_value.hasValue();
}

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
const t_TYPE&
Optional_Base<t_TYPE, false>::value() const&
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return d_value.value();
}

template <class t_TYPE>
inline
const t_TYPE&&
Optional_Base<t_TYPE, false>::value() const&&
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return std::move(d_value.value());
}

#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
const t_TYPE&
Optional_Base<t_TYPE, false>::value() const
{
    if (!has_value())
        BSLS_THROW(bsl::bad_optional_access());

    return d_value.value();
}

#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS

template <class t_TYPE>
template <class t_ANY_TYPE>
inline
t_TYPE
Optional_Base<t_TYPE, false>::value_or(
                           BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
const &
{
    if (has_value()) {
        return t_TYPE(d_value.value());                               // RETURN
    }
    else {
        return t_TYPE(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE,
                                                    value));          // RETURN
    }
}

#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
template <class t_ANY_TYPE>
inline
t_TYPE
Optional_Base<t_TYPE, false>::value_or(
                           BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
const
{
    if (has_value()) {
        return t_TYPE(d_value.value());                               // RETURN
    }
    else {
        return t_TYPE(BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE,
                                                    value));          // RETURN
    }
}

#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

template <class t_TYPE>
inline
const t_TYPE *Optional_Base<t_TYPE, false>::operator->() const
{
    BSLS_ASSERT(has_value());

    return BSLS_UTIL_ADDRESSOF(d_value.value());
}

#  ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
const t_TYPE& Optional_Base<t_TYPE, false>::operator*() const&
{
    BSLS_ASSERT(has_value());

    return d_value.value();
}

template <class t_TYPE>
inline
const t_TYPE&& Optional_Base<t_TYPE, false>::operator*() const&&
{
    BSLS_ASSERT(has_value());

    return std::move(d_value.value());
}

#  else  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
template <class t_TYPE>
inline
const t_TYPE& Optional_Base<t_TYPE, false>::operator*() const
{
    BSLS_ASSERT(has_value());

    return d_value.value();
}
#  endif  // BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS else

#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
template <class t_TYPE>
Optional_Base<t_TYPE, false>::operator bool() const BSLS_KEYWORD_NOEXCEPT
{
    return has_value();
}
#endif  // BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
# endif  // else BSLSTL_OPTIONAL_USES_STD_ALIASES

}  // close package namespace
}  // close enterprise namespace

// ============================================================================
//                   Section: 'optional' Method Definitions
// ============================================================================

                               // ==============
                               // class optional
                               // ==============

namespace bsl {

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
// PRIVATE CREATORS
template <class t_TYPE>
template <class t_INVOCABLE, class t_ARG>
inline
optional<t_TYPE>::optional(
                  BloombergLP::bslstl::Optional_InvokeConstructorTag tag,
                  t_INVOCABLE&&                                      invocable,
                  t_ARG&&                                            arg)
: BaseType(tag, std::forward<t_INVOCABLE>(invocable), std::forward<t_ARG>(arg))
{
}
#endif

// CREATORS
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 optional<t_TYPE>::optional() BSLS_KEYWORD_NOEXCEPT
: BaseType()
{
}

template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT
: BaseType()
{
}

#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
template <class t_TYPE>
template <class t_DERIVED>
optional<t_TYPE>::optional(
                    BloombergLP::bslmf::MovableRef<t_DERIVED> original,
                    BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(t_DERIVED))
    BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                             bsl::is_nothrow_move_constructible<t_TYPE>::value)
: BaseType(MoveUtil::move(static_cast<BaseType&>(original)))
{
}
#endif

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 optional<t_TYPE>::optional(
          BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
          BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE),
          BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(BloombergLP::bslstl::Optional_ConstructFromForwardRef(),
           BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 optional<t_TYPE>::optional(
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
              BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE),
              BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(BloombergLP::bslstl::Optional_ConstructFromForwardRef(),
           BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>::optional(
     const optional<t_ANY_TYPE>& original,
     BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE,
                                                            const t_ANY_TYPE&),
     BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                      const t_ANY_TYPE&))
: BaseType(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional(),
           original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>::optional(
     const optional<t_ANY_TYPE>& original,
     BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE,
                                                            const t_ANY_TYPE&),
     BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE&))
: BaseType(BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional(),
           original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>::optional(
    BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE),
    BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional(),
           MoveUtil::move(
                  static_cast<BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>&>(
                      original)))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>::optional(
    BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE),
    BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional(),
           MoveUtil::move(
                  static_cast<BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>&>(
                      original)))
{
}

#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>::optional(
     const std::optional<t_ANY_TYPE>& original,
     BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE,
                                                            const t_ANY_TYPE&),
     BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional(),
           original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>::optional(
     const std::optional<t_ANY_TYPE>& original,
     BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE,
                                                            const t_ANY_TYPE&),
     BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(BloombergLP::bslstl::Optional_CopyConstructFromStdOptional(),
           original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>::optional(
    std::optional<t_ANY_TYPE>&& original,
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE, t_ANY_TYPE),
    BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional(),
           std::move(original))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>::optional(
    std::optional<t_ANY_TYPE>&& original,
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE, t_ANY_TYPE),
    BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(BloombergLP::bslstl::Optional_MoveConstructFromStdOptional(),
           std::move(original))
{
}
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_S
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_S BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t)
: BaseType(bsl::in_place)
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1
template <class t_TYPE>
template <class t_ARGS_01>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                          BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10

#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0
template <class t_TYPE>
template <class t_INIT_LIST_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il)
: BaseType(bsl::in_place, il)
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                          BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
: BaseType(bsl::in_place, il,BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                             BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_S >= 10

#endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE>
template <class... t_ARGS>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
: BaseType(bsl::in_place, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...)
{
}
#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
BSLSTL_OPTIONAL_CONSTEXPR17
optional<t_TYPE>::optional(bsl::in_place_t,
                           std::initializer_list<t_INIT_LIST_TYPE>      il,
                           BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
: BaseType(bsl::in_place, il, BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...)
{
}
#endif
// }}} END GENERATED CODE
#endif

template <class t_TYPE>
optional<t_TYPE>::optional(bsl::allocator_arg_t, AllocType allocator)
: BaseType(bsl::allocator_arg, allocator)
{
}

template <class t_TYPE>
optional<t_TYPE>::optional(bsl::allocator_arg_t,
                           AllocType allocator,
                           bsl::nullopt_t)
: BaseType(bsl::allocator_arg, allocator)
{
}

template <class t_TYPE>
optional<t_TYPE>::optional(bsl::allocator_arg_t,
                           AllocType       allocator,
                           const optional& original)
: BaseType(bsl::allocator_arg, allocator, original)
{
}

template <class t_TYPE>
template <class t_DERIVED>
optional<t_TYPE>::optional(bsl::allocator_arg_t,
                           AllocType                          allocator,
                           BSLMF_MOVABLEREF_DEDUCE(t_DERIVED) original,
                           BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(
                              typename bsl::remove_reference<t_DERIVED>::type))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           MoveUtil::move(static_cast<BaseType&>(original)))
{
    // Implementation Note: The 'remove_reference' in the signature is needed
    // to work around a bug in GCC 10.  (It has not been determined whether
    // other versions are affected.)
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
          bsl::allocator_arg_t,
          AllocType                                     allocator,
          BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
          BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE),
          BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_ConstructFromForwardRef(),
           BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
             bsl::allocator_arg_t,
             AllocType                                     allocator,
             BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value,
             BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE),
             BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_ConstructFromForwardRef(),
           BSLS_COMPILERFEATURES_FORWARD(t_ANY_TYPE, value))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
     bsl::allocator_arg_t,
     AllocType                   allocator,
     const optional<t_ANY_TYPE>& original,
     BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE,
                                                            const t_ANY_TYPE&),
     BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                      const t_ANY_TYPE&))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional(),
           original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
     bsl::allocator_arg_t,
     AllocType                   allocator,
     const optional<t_ANY_TYPE>& original,
     BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE,
                                                            const t_ANY_TYPE&),
     BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE&))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional(),
           original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
    bsl::allocator_arg_t,
    AllocType                                     allocator,
    BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE),
    BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional(),
           MoveUtil::move(
                  static_cast<BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>&>(
                      original)))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
    bsl::allocator_arg_t,
    AllocType                                     allocator,
    BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) original,
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE),
    BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional(),
           MoveUtil::move(
                  static_cast<BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>&>(
                      original)))
{
}

#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
     bsl::allocator_arg_t,
     AllocType                        allocator,
     const std::optional<t_ANY_TYPE>& original,
     BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE,
                                                            const t_ANY_TYPE&),
     BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE,
                                                      const t_ANY_TYPE&))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_CopyConstructFromStdOptional(),
           original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
     bsl::allocator_arg_t,
     AllocType                        allocator,
     const std::optional<t_ANY_TYPE>& original,
     BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE,
                                                            const t_ANY_TYPE&),
     BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_CopyConstructFromStdOptional(),
           original)
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
    bsl::allocator_arg_t,
    AllocType                   allocator,
    std::optional<t_ANY_TYPE>&& original,
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE, t_ANY_TYPE),
    BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_MoveConstructFromStdOptional(),
           std::move(original))
{
}

template <class t_TYPE>
template <class t_ANY_TYPE>
optional<t_TYPE>::optional(
    bsl::allocator_arg_t,
    AllocType                   allocator,
    std::optional<t_ANY_TYPE>&& original,
    BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL(t_TYPE, t_ANY_TYPE),
    BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
: BaseType(bsl::allocator_arg_t(),
           allocator,
           BloombergLP::bslstl::Optional_MoveConstructFromStdOptional(),
           std::move(original))
{
}
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_T
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_T BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0
template <class t_TYPE>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place)
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1
template <class t_TYPE>
template <class t_ARGS_01>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10
template <class t_TYPE>
template <class t_ARGS_01,
          class t_ARGS_02,
          class t_ARGS_03,
          class t_ARGS_04,
          class t_ARGS_05,
          class t_ARGS_06,
          class t_ARGS_07,
          class t_ARGS_08,
          class t_ARGS_09,
          class t_ARGS_10>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10

#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0
template <class t_TYPE>
template <class t_INIT_LIST_TYPE>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il)
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class t_ARGS_01,
                                  class t_ARGS_02,
                                  class t_ARGS_03,
                                  class t_ARGS_04,
                                  class t_ARGS_05,
                                  class t_ARGS_06,
                                  class t_ARGS_07,
                                  class t_ARGS_08,
                                  class t_ARGS_09,
                                  class t_ARGS_10>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10))
{
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_T >= 10

#endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE>
template <class... t_ARGS>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...)
{
}
#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE>
template <class t_INIT_LIST_TYPE, class... t_ARGS>
optional<t_TYPE>::optional(
                        bsl::allocator_arg_t,
                        AllocType                                    allocator,
                        bsl::in_place_t,
                        std::initializer_list<t_INIT_LIST_TYPE>      il,
                        BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
: BaseType(bsl::allocator_arg,
           allocator,
           bsl::in_place,
           il,
           BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...)
{
}
#endif
// }}} END GENERATED CODE
#endif

// MANIPULATORS
template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20 optional<t_TYPE>&
optional<t_TYPE>::operator=(bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT
{
    this->reset();
    return *this;
}

#if !defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
template <class t_TYPE>
template <class t_DERIVED>
BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED(t_TYPE, t_DERIVED) &
optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_DERIVED> rhs)
{
    BaseType& lvalue = rhs;
    BaseType::operator=(MoveUtil::move(lvalue));
    return *this;
}
#endif

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE&)&
optional<t_TYPE>::operator=(const optional<t_ANY_TYPE>& rhs)
{
    if (rhs.has_value()) {
        this->assignOrEmplace(*rhs);
    } else {
        this->reset();
    }
    return *this;
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)&
optional<t_TYPE>::operator=(BSLMF_MOVABLEREF_DEDUCE(optional<t_ANY_TYPE>) rhs)
{
    BloombergLP::bslstl::Optional_Base<t_ANY_TYPE>& lvalue = rhs;
    if (lvalue.has_value()) {
        this->assignOrEmplace(MoveUtil::move(*lvalue));
    } else {
        this->reset();
    }
    return *this;
}

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_FORWARD_REF(t_TYPE, t_ANY_TYPE)&
optional<t_TYPE>::operator=(t_ANY_TYPE&& rhs)
{
    this->assignOrEmplace(std::forward<t_ANY_TYPE>(rhs));
    return *this;
}
#else
template <class t_TYPE>
optional<t_TYPE>& optional<t_TYPE>::operator=(const t_TYPE& rhs)
{
    this->assignOrEmplace(rhs);
    return *this;
}

template <class t_TYPE>
optional<t_TYPE>&
optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_TYPE> rhs)
{
    this->assignOrEmplace(MoveUtil::move(rhs));
    return *this;
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(t_TYPE, t_ANY_TYPE)&
optional<t_TYPE>::operator=(const t_ANY_TYPE& rhs)
{
    this->assignOrEmplace(rhs);
    return *this;
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE(t_TYPE, t_ANY_TYPE)&
optional<t_TYPE>::operator=(BloombergLP::bslmf::MovableRef<t_ANY_TYPE> rhs)
{
    this->assignOrEmplace(MoveUtil::move(rhs));
    return *this;
}
#endif  // RVALUES else

#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(t_TYPE, const t_ANY_TYPE&)&
optional<t_TYPE>::operator=(const std::optional<t_ANY_TYPE>& rhs)
{
    if (rhs.has_value()) {
        this->assignOrEmplace(*rhs);
    } else {
        this->reset();
    }
    return *this;
}

template <class t_TYPE>
template <class t_ANY_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL(t_TYPE, t_ANY_TYPE)&
optional<t_TYPE>::operator=(std::optional<t_ANY_TYPE>&& rhs)
{
    if (rhs.has_value()) {
        this->assignOrEmplace(std::move(*rhs));
    } else {
        this->reset();
    }
    return *this;
}
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
template <class t_TYPE>
template <class t_FUNC>
constexpr auto optional<t_TYPE>::transform(t_FUNC&& func) &
{
    using ResultType = std::remove_cv_t<std::invoke_result_t<t_FUNC, t_TYPE&>>;
    static_assert(!std::is_array_v<ResultType>,
                  "The callable must return an array");
    static_assert(!std::is_same_v<ResultType, nullopt_t>,
                  "The callable must not return nullopt_t");
    static_assert(!std::is_same_v<ResultType, in_place_t>,
                  "The callable must not return in_place_t");
    static_assert(std::is_object_v<ResultType>,
                  "The callable must return an object type");

    if (this->has_value()) {
        using BloombergLP::bslstl::Optional_InvokeConstructorTag;
        return optional<ResultType>{Optional_InvokeConstructorTag{},
                                    std::forward<t_FUNC>(func),
                                    **this};
    }
    return optional<ResultType>{};
}

template <class t_TYPE>
template <class t_FUNC>
constexpr auto optional<t_TYPE>::transform(t_FUNC&& func) const &
{
    using ResultType =
                 std::remove_cv_t<std::invoke_result_t<t_FUNC, const t_TYPE&>>;
    static_assert(!std::is_array_v<ResultType>,
                  "The callable must return an array");
    static_assert(!std::is_same_v<ResultType, nullopt_t>,
                  "The callable must not return nullopt_t");
    static_assert(!std::is_same_v<ResultType, in_place_t>,
                  "The callable must not return in_place_t");
    static_assert(std::is_object_v<ResultType>,
                  "The callable must return an object type");

    if (this->has_value()) {
        using BloombergLP::bslstl::Optional_InvokeConstructorTag;
        return optional<ResultType>{Optional_InvokeConstructorTag{},
                                    std::forward<t_FUNC>(func),
                                    **this};
    }
    return optional<ResultType>{};
}

template <class t_TYPE>
template <class t_FUNC>
constexpr auto optional<t_TYPE>::transform(t_FUNC&& func) &&
{
    using ResultType =
                      std::remove_cv_t<std::invoke_result_t<t_FUNC, t_TYPE&&>>;
    static_assert(!std::is_array_v<ResultType>,
                  "The callable must return an array");
    static_assert(!std::is_same_v<ResultType, nullopt_t>,
                  "The callable must not return nullopt_t");
    static_assert(!std::is_same_v<ResultType, in_place_t>,
                  "The callable must not return in_place_t");
    static_assert(std::is_object_v<ResultType>,
                  "The callable must return an object type");

    if (this->has_value()) {
        using BloombergLP::bslstl::Optional_InvokeConstructorTag;
        return optional<ResultType>{Optional_InvokeConstructorTag{},
                                    std::forward<t_FUNC>(func),
                                    std::move(**this)};
    }
    return optional<ResultType>{};
}

template <class t_TYPE>
template <class t_FUNC>
constexpr auto optional<t_TYPE>::transform(t_FUNC&& func) const &&
{
    using ResultType =
                std::remove_cv_t<std::invoke_result_t<t_FUNC, const t_TYPE&&>>;
    static_assert(!std::is_array_v<ResultType>,
                  "The callable must return an array");
    static_assert(!std::is_same_v<ResultType, nullopt_t>,
                  "The callable must not return nullopt_t");
    static_assert(!std::is_same_v<ResultType, in_place_t>,
                  "The callable must not return in_place_t");
    static_assert(std::is_object_v<ResultType>,
                  "The callable must return an object type");

    if (this->has_value()) {
        using BloombergLP::bslstl::Optional_InvokeConstructorTag;
        return optional<ResultType>{Optional_InvokeConstructorTag{},
                                    std::forward<t_FUNC>(func),
                                    std::move(**this)};
    }
    return optional<ResultType>{};
}

template <class t_TYPE>
template <class t_FUNC>
constexpr auto optional<t_TYPE>::and_then(t_FUNC&& func) &
{
    using ResultType = std::remove_cv_t<std::remove_reference_t<
                                       std::invoke_result_t<t_FUNC, t_TYPE&>>>;
    using ::BloombergLP::bslstl::Optional_IsBslOptional;
    static_assert(Optional_IsBslOptional<ResultType>::value,
                  "The callable must return bsl::optional");

    if (this->has_value()) {
        return std::invoke(std::forward<t_FUNC>(func), **this);
    }
    return ResultType{};
}

template <class t_TYPE>
template <class t_FUNC>
constexpr auto optional<t_TYPE>::and_then(t_FUNC&& func) const &
{
    using ResultType = std::remove_cv_t<std::remove_reference_t<
                                 std::invoke_result_t<t_FUNC, const t_TYPE&>>>;
    using ::BloombergLP::bslstl::Optional_IsBslOptional;
    static_assert(Optional_IsBslOptional<ResultType>::value,
                  "The callable must return bsl::optional");

    if (this->has_value()) {
        return std::invoke(std::forward<t_FUNC>(func), **this);
    }
    return ResultType{};
}

template <class t_TYPE>
template <class t_FUNC>
constexpr auto optional<t_TYPE>::and_then(t_FUNC&& func) &&
{
    using ResultType = std::remove_cv_t<std::remove_reference_t<
                                      std::invoke_result_t<t_FUNC, t_TYPE&&>>>;
    using ::BloombergLP::bslstl::Optional_IsBslOptional;
    static_assert(Optional_IsBslOptional<ResultType>::value,
                  "The callable must return bsl::optional");

    if (this->has_value()) {
        return std::invoke(std::forward<t_FUNC>(func), std::move(**this));
    }
    return ResultType{};
}

template <class t_TYPE>
template <class t_FUNC>
constexpr auto optional<t_TYPE>::and_then(t_FUNC&& func) const &&
{
    using ResultType = std::remove_cv_t<std::remove_reference_t<
                                std::invoke_result_t<t_FUNC, const t_TYPE&&>>>;
    using ::BloombergLP::bslstl::Optional_IsBslOptional;
    static_assert(Optional_IsBslOptional<ResultType>::value,
                  "The callable must return bsl::optional");

    if (this->has_value()) {
        return std::invoke(std::forward<t_FUNC>(func), std::move(**this));
    }
    return ResultType{};
}

template <class t_TYPE>
template <class t_FUNC>
constexpr
enable_if_t<conjunction_v<std::is_invocable<t_FUNC>,
                          std::is_copy_constructible<t_TYPE>>,
            optional<t_TYPE>> optional<t_TYPE>::or_else(t_FUNC&& func) const &
{
    static_assert(std::is_same_v<remove_cvref_t<std::invoke_result_t<t_FUNC>>,
                                 optional<t_TYPE>>,
                  "The callable must return bsl::optional<T>");

    if (this->has_value()) {
        return *this;
    }
    return std::forward<t_FUNC>(func)();
}

template <class t_TYPE>
template <class t_FUNC>
constexpr
enable_if_t<conjunction_v<std::is_invocable<t_FUNC>,
                          std::is_move_constructible<t_TYPE>>,
            optional<t_TYPE>> optional<t_TYPE>::or_else(t_FUNC&& func) &&
{
    static_assert(std::is_same_v<remove_cvref_t<std::invoke_result_t<t_FUNC>>,
                                 optional<t_TYPE>>,
                  "The callable must return bsl::optional<T>");

    if (this->has_value()) {
        return std::move(*this);
    }
    return std::forward<t_FUNC>(func)();
}
#endif  // BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY

// ============================================================================
//                      Section: Free Function Definitions
// ============================================================================

template <class t_TYPE>
inline
typename bsl::enable_if<BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value,
                        void>::type
swap(bsl::optional<t_TYPE>& lhs, bsl::optional<t_TYPE>& rhs)
{
    if (lhs.get_allocator() == rhs.get_allocator()) {
        lhs.swap(rhs);

        return;                                                       // RETURN
    }

    bsl::optional<t_TYPE> futureLhs(
        bsl::allocator_arg, lhs.get_allocator(), rhs);
    bsl::optional<t_TYPE> futureRhs(
        bsl::allocator_arg, rhs.get_allocator(), lhs);

    futureLhs.swap(lhs);
    futureRhs.swap(rhs);
}

template <class t_TYPE>
inline BSLSTL_OPTIONAL_CONSTEXPR20
typename bsl::enable_if<!BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value,
                        void>::type
swap(bsl::optional<t_TYPE>& lhs, bsl::optional<t_TYPE>& rhs)
{
    lhs.swap(rhs);
}

// HASH SPECIALIZATIONS
template <class t_HASHALG, class t_TYPE>
void hashAppend(t_HASHALG& hashAlg, const bsl::optional<t_TYPE>& input)
{
    using ::BloombergLP::bslh::hashAppend;

    if (input.has_value()) {
        hashAppend(hashAlg, true);
        hashAppend(hashAlg, *input);
    }
    else {
        hashAppend(hashAlg, false);
    }
}

// FREE OPERATORS

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator==(const bsl::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (lhs.has_value() && rhs.has_value()) {
        return *lhs == *rhs;                                          // RETURN
    }
    return lhs.has_value() == rhs.has_value();
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator!=(const bsl::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (lhs.has_value() && rhs.has_value()) {
        return *lhs != *rhs;                                          // RETURN
    }

    return lhs.has_value() != rhs.has_value();
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<(const bsl::optional<t_LHS_TYPE>& lhs,
               const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!rhs.has_value()) {
        return false;                                                 // RETURN
    }

    return !lhs.has_value() || *lhs < *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>(const bsl::optional<t_LHS_TYPE>& lhs,
               const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!lhs.has_value()) {
        return false;                                                 // RETURN
    }

    return !rhs.has_value() || *lhs > *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<=(const bsl::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!lhs.has_value()) {
        return true;                                                  // RETURN
    }

    return rhs.has_value() && *lhs <= *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>=(const bsl::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!rhs.has_value()) {
        return true;                                                  // RETURN
    }
    return lhs.has_value() && *lhs >= *rhs;
}

// comparison with 'nullopt_t'

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator==(
                                   const bsl::optional<t_TYPE>& value,
                                   const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT
{
    return !value.has_value();
}

#if !(defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) &&          \
      defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS))
template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator==(
                      const bsl::nullopt_t&,
                      const bsl::optional<t_TYPE>& value) BSLS_KEYWORD_NOEXCEPT
{
    return !value.has_value();
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator!=(
                                   const bsl::optional<t_TYPE>& value,
                                   const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT
{
    return value.has_value();
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator!=(
                      const bsl::nullopt_t&,
                      const bsl::optional<t_TYPE>& value) BSLS_KEYWORD_NOEXCEPT
{
    return value.has_value();
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator<(
                                   const bsl::optional<t_TYPE>&,
                                   const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT
{
    return false;
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator<(
                      const bsl::nullopt_t&,
                      const bsl::optional<t_TYPE>& value) BSLS_KEYWORD_NOEXCEPT
{
    return value.has_value();
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator>(
                                   const bsl::optional<t_TYPE>& value,
                                   const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT
{
    return value.has_value();
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator>(
                            const bsl::nullopt_t&,
                            const bsl::optional<t_TYPE>&) BSLS_KEYWORD_NOEXCEPT
{
    return false;
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator<=(
                                   const bsl::optional<t_TYPE>& value,
                                   const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT
{
    return !value.has_value();
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator<=(
                            const bsl::nullopt_t&,
                            const bsl::optional<t_TYPE>&) BSLS_KEYWORD_NOEXCEPT
{
    return true;
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator>=(
                                   const bsl::optional<t_TYPE>&,
                                   const bsl::nullopt_t&) BSLS_KEYWORD_NOEXCEPT
{
    return true;
}

template <class t_TYPE>
inline
BSLSTL_OPTIONAL_CONSTEXPR17 bool operator>=(
                      const bsl::nullopt_t&,
                      const bsl::optional<t_TYPE>& value) BSLS_KEYWORD_NOEXCEPT
{
    return !value.has_value();
}
#endif  // !(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS &&
        //   BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON)

// comparison with 'value_type'

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator==(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs == rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return lhs.has_value() && *lhs == rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator==(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return rhs.has_value() && lhs == *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator!=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs != rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return !lhs.has_value() || *lhs != rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator!=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return !rhs.has_value() || lhs != *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs < rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return !lhs.has_value() || *lhs < rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return rhs.has_value() && lhs < *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs > rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return lhs.has_value() && *lhs > rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return !rhs.has_value() || lhs > *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs <= rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return !lhs.has_value() || *lhs <= rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator<=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return rhs.has_value() && lhs <= *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>=(const bsl::optional<t_LHS_TYPE>& lhs, const t_RHS_TYPE& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS_TYPE>
        && requires {
            { *lhs >= rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return lhs.has_value() && *lhs >= rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17
bool operator>=(const t_LHS_TYPE& lhs, const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(
        !BloombergLP::bslstl::Optional_DerivedFromOptional<t_LHS_TYPE>
        && requires {
            { lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
        })
{
    return !rhs.has_value() || lhs >= *rhs;
}

#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON \
 && defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
template <class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
BSLSTL_OPTIONAL_CONSTEXPR20
compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
                                               const bsl::optional<t_LHS>& lhs,
                                               const bsl::optional<t_RHS>& rhs)
{
    const bool lhs_has_value = lhs.has_value(),
               rhs_has_value = rhs.has_value();
    if (lhs_has_value && rhs_has_value) {
        return *lhs <=> *rhs;
    }
    return lhs_has_value <=> rhs_has_value;
}

template <class t_LHS, class t_RHS>
requires (!BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS>) &&
         three_way_comparable_with<t_LHS, t_RHS>
BSLSTL_OPTIONAL_CONSTEXPR20
compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
                                               const bsl::optional<t_LHS>& lhs,
                                               const t_RHS&                rhs)
{
    if (lhs) {
        return *lhs <=> rhs;
    }
    return strong_ordering::less;
}

template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR20
strong_ordering operator<=>(const bsl::optional<t_TYPE>& value,
                            bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT
{
    return value.has_value() <=> false;
}

template <class t_LHS, three_way_comparable_with<t_LHS> t_RHS>
BSLSTL_OPTIONAL_CONSTEXPR20
compare_three_way_result_t<t_LHS, t_RHS> operator<=>(
                                               const bsl::optional<t_LHS>& lhs,
                                               const std::optional<t_RHS>& rhs)
{
    const bool lhs_has_value = lhs.has_value(),
               rhs_has_value = rhs.has_value();
    if (lhs_has_value && rhs_has_value) {
        return *lhs <=> *rhs;
    }
    return lhs_has_value <=> rhs_has_value;
}
#endif  // BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON &&
        // BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS

# ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
template <class t_TYPE>
inline
typename bsl::enable_if<!BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value,
                        void>::type
swap(bsl::optional<t_TYPE>& lhs, std::optional<t_TYPE>& rhs)
{
    lhs.swap(rhs);
}

template <class t_TYPE>
inline BSLSTL_OPTIONAL_CONSTEXPR20
typename bsl::enable_if<!BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value,
                        void>::type
swap(std::optional<t_TYPE>& lhs, bsl::optional<t_TYPE>& rhs)
{
    lhs.swap(rhs);
}

// comparison with 'std::optional'

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator==(const bsl::optional<t_LHS_TYPE>& lhs,
                const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (lhs.has_value() && rhs.has_value()) {
        return *lhs == *rhs;
    }
    return lhs.has_value() == rhs.has_value();
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator==(const std::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs == *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (lhs.has_value() && rhs.has_value()) {
        return *lhs == *rhs;
    }
    return lhs.has_value() == rhs.has_value();
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator!=(const bsl::optional<t_LHS_TYPE>& lhs,
                const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (lhs.has_value() && rhs.has_value()) {
        return *lhs != *rhs;
    }

    return lhs.has_value() != rhs.has_value();
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator!=(const std::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs != *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (lhs.has_value() && rhs.has_value()) {
        return *lhs != *rhs;
    }

    return lhs.has_value() != rhs.has_value();
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator<(const bsl::optional<t_LHS_TYPE>& lhs,
               const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!rhs.has_value()) {
        return false;                                                 // RETURN
    }

    return !lhs.has_value() || *lhs < *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator<(const std::optional<t_LHS_TYPE>& lhs,
               const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs < *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!rhs.has_value()) {
        return false;                                                 // RETURN
    }

    return !lhs.has_value() || *lhs < *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator>(const bsl::optional<t_LHS_TYPE>& lhs,
               const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!lhs.has_value()) {
        return false;                                                 // RETURN
    }

    return !rhs.has_value() || *lhs > *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator>(const std::optional<t_LHS_TYPE>& lhs,
               const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs > *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!lhs.has_value()) {
        return false;                                                 // RETURN
    }

    return !rhs.has_value() || *lhs > *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator<=(const bsl::optional<t_LHS_TYPE>& lhs,
                const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!lhs.has_value()) {
        return true;                                                  // RETURN
    }

    return rhs.has_value() && *lhs <= *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator<=(const std::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs <= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!lhs.has_value()) {
        return true;                                                  // RETURN
    }

    return rhs.has_value() && *lhs <= *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator>=(const bsl::optional<t_LHS_TYPE>& lhs,
                const std::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!rhs.has_value()) {
        return true;                                                  // RETURN
    }
    return lhs.has_value() && *lhs >= *rhs;
}

template <class t_LHS_TYPE, class t_RHS_TYPE>
constexpr
bool operator>=(const std::optional<t_LHS_TYPE>& lhs,
                const bsl::optional<t_RHS_TYPE>& rhs)
    BSLSTL_OPTIONAL_REQUIRES(requires {
        { *lhs >= *rhs } -> BloombergLP::bslstl::Optional_ConvertibleToBool;
    })
{
    if (!rhs.has_value()) {
        return true;                                                  // RETURN
    }
    return lhs.has_value() && *lhs >= *rhs;
}
# endif  // BSLSTL_OPTIONAL_USES_STD_ALIASES

template <class t_TYPE>
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)
{
    return bsl::optional<typename bsl::decay<t_TYPE>::type>(
                                   bsl::allocator_arg,
                                   alloc,
                                   bsl::in_place,
                                   BSLS_COMPILERFEATURES_FORWARD(t_TYPE, rhs));
}

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_U
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_U BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 0
template <class t_TYPE>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 1
template <class t_TYPE, class t_ARGS_01>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 2
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 3
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 4
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 5
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 6
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 7
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06,
                        class t_ARGS_07>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 8
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06,
                        class t_ARGS_07,
                        class t_ARGS_08>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 9
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06,
                        class t_ARGS_07,
                        class t_ARGS_08,
                        class t_ARGS_09>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 10
template <class t_TYPE, class t_ARGS_01,
                        class t_ARGS_02,
                        class t_ARGS_03,
                        class t_ARGS_04,
                        class t_ARGS_05,
                        class t_ARGS_06,
                        class t_ARGS_07,
                        class t_ARGS_08,
                        class t_ARGS_09,
                        class t_ARGS_10>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_U >= 10

#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE, class... t_ARGS>
bsl::optional<t_TYPE> make_optional(
                 bsl::allocator_arg_t,
                 typename bsl::optional<t_TYPE>::allocator_type const&   alloc,
                 BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...            args)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}
// }}} END GENERATED CODE
#endif

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_V
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_V BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 0
template <class t_TYPE, class t_INIT_LIST_TYPE>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 1
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 2
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 3
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 4
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 5
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 6
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 7
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 8
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 9
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08,
                                                class t_ARGS_09>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 10
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08,
                                                class t_ARGS_09,
                                                class t_ARGS_10>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_V >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE, class t_INIT_LIST_TYPE, class... t_ARGS>
bsl::optional<t_TYPE> make_optional(
                   bsl::allocator_arg_t,
                   typename bsl::optional<t_TYPE>::allocator_type const& alloc,
                   std::initializer_list<t_INIT_LIST_TYPE>               il,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...          args)
{
    return bsl::optional<t_TYPE>(
                               bsl::allocator_arg,
                               alloc,
                               bsl::in_place,
                               il,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}
#  endif
// }}} END GENERATED CODE
#endif

template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<typename bsl::decay<t_TYPE>::type>
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) rhs)
{
    return bsl::optional<typename bsl::decay<t_TYPE>::type>(
        BSLS_COMPILERFEATURES_FORWARD(t_TYPE, rhs));
}

template <class t_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE> make_optional()
{
    return bsl::optional<t_TYPE>(bsl::in_place);
}

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_optional.h
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_OPTIONAL_VARIADIC_LIMIT_W
#define BSLSTL_OPTIONAL_VARIADIC_LIMIT_W BSLSTL_OPTIONAL_VARIADIC_LIMIT
#endif
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0
template <class t_TYPE, class t_ARG>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1
template <class t_TYPE, class t_ARG, class t_ARGS_01>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06,
                                     class t_ARGS_07>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06,
                                     class t_ARGS_07,
                                     class t_ARGS_08>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06,
                                     class t_ARGS_07,
                                     class t_ARGS_08,
                                     class t_ARGS_09>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10
template <class t_TYPE, class t_ARG, class t_ARGS_01,
                                     class t_ARGS_02,
                                     class t_ARGS_03,
                                     class t_ARGS_04,
                                     class t_ARGS_05,
                                     class t_ARGS_06,
                                     class t_ARGS_07,
                                     class t_ARGS_08,
                                     class t_ARGS_09,
                                     class t_ARGS_10>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10


#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0
template <class t_TYPE, class t_INIT_LIST_TYPE>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il);
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 0

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 1

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 2

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 3

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 4

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 5

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 6

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 7

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 8

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08,
                                                class t_ARGS_09>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 9

#if BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10
template <class t_TYPE, class t_INIT_LIST_TYPE, class t_ARGS_01,
                                                class t_ARGS_02,
                                                class t_ARGS_03,
                                                class t_ARGS_04,
                                                class t_ARGS_05,
                                                class t_ARGS_06,
                                                class t_ARGS_07,
                                                class t_ARGS_08,
                                                class t_ARGS_09,
                                                class t_ARGS_10>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_01) args_01,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_02) args_02,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_03) args_03,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_04) args_04,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_05) args_05,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_06) args_06,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_07) args_07,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_08) args_08,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_09) args_09,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS_10) args_10)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_01, args_01),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_02, args_02),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_03, args_03),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_04, args_04),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_05, args_05),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_06, args_06),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_07, args_07),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_08, args_08),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_09, args_09),
                            BSLS_COMPILERFEATURES_FORWARD(t_ARGS_10, args_10));
}
#endif  // BSLSTL_OPTIONAL_VARIADIC_LIMIT_W >= 10

#  endif
#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class t_TYPE, class t_ARG, class... t_ARGS>
BSLSTL_OPTIONAL_CONSTEXPR17 BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG(t_ARG)
make_optional(BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)     arg,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARG, arg),
                               BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}

#  if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
template <class t_TYPE, class t_INIT_LIST_TYPE, class... t_ARGS>
BSLSTL_OPTIONAL_CONSTEXPR17 bsl::optional<t_TYPE>
make_optional(std::initializer_list<t_INIT_LIST_TYPE>      il,
              BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
{
    return bsl::optional<t_TYPE>(
                               bsl::in_place,
                               il,
                               BSLS_COMPILERFEATURES_FORWARD(t_ARGS, args)...);
}
#  endif
// }}} END GENERATED CODE
#endif
}  // close namespace bsl

// There is a problem in the standard definition of the is-optional concept
// that results in types inheriting from std::optional not being identified
// correctly as optional types.  The end result is endless recursion evaluating
// the requires clause for the spaceship operator when it is implemented
// according to the C++20 specification, which happens for GCC 11-14 and
// MSVC-2022 prior to MSVC 19.36 when building with C++20 and later. In MSVC
// 19.36 Microsoft implemented the solution suggested in LWG-3746, so the
// workaround is not required for that and subsequent versions; similarly, the
// issue will be resolved in GCC 15 (to be released).
//
// The issue with the standard is tracked here:
// https://cplusplus.github.io/LWG/issue3746
//
// See DRQS 170388558 for more information
//
// BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_GNU_WORKAROUND_NEEDED and
// BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_MSVC_WORKAROUND_NEEDED are deliberately
// exposed to allow their use in higher level optional types (i.e.,
// bdlb::NullableValue).

// The following hacks prevent compiler crashes, and should only be applied on
// compiler versions where the problem is not fixed.  The hacks required for
// gcc and for MSVC are different due to different standard library
// implementations, hence the two distinct macros and implementations.

# if BSLS_COMPILERFEATURES_CPLUSPLUS >= 202002L && \
     defined(BSLS_LIBRARYFEATURES_STDCPP_GNU) && \
     (11 <= _GLIBCXX_RELEASE && _GLIBCXX_RELEASE <= 14)

#define BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_GNU_WORKAROUND_NEEDED

namespace std {
template<typename _Tp>
inline constexpr bool __is_optional_v<bsl::optional<_Tp>> = true;
}

# endif // BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_GNU_WORKAROUND_NEEDED

# if BSLS_COMPILERFEATURES_CPLUSPLUS == 202002L &&                            \
     defined(BSLS_PLATFORM_CMP_MSVC) &&                                       \
     (BSLS_PLATFORM_CMP_VERSION >= 1930 && BSLS_PLATFORM_CMP_VERSION < 1936)
    // This workaround is not required from MSVC 19.36 onwards.

#define BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_MSVC_WORKAROUND_NEEDED

namespace std {
template <typename _Tp>
inline constexpr bool _Is_specialization_v<bsl::optional<_Tp>, std::optional> =
    true;
}

# endif // BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_MSVC_WORKAROUND_NEEDED

#undef BSLSTL_OPTIONAL_CONSTEXPR17
#undef BSLSTL_OPTIONAL_CONSTEXPR20
#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL
#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL
#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_STD_OPTIONAL
#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_STD_OPTIONAL
#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR
#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_PROPAGATES_ALLOCATOR
#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR
#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCT_DOES_NOT_PROPAGATE_ALLOCATOR
#undef BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM
#undef BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM
#undef BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL
#undef BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT
#undef BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT
#undef BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT
#undef BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT
#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL
#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_STD_OPTIONAL
#undef BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED
#undef BSLSTL_OPTIONAL_ENABLE_IF_NOT_ALLOCATOR_TAG
#undef BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG
#undef BSLSTL_OPTIONAL_REQUIRES

#else // if ! defined(DEFINED_BSLSTL_OPTIONAL_H)
# error Not valid except when included from bslstl_optional.h
#endif // ! defined(COMPILING_BSLSTL_OPTIONAL_H)

#endif // ! defined(INCLUDED_BSLSTL_OPTIONAL_CPP03)

// ----------------------------------------------------------------------------
// Copyright 2020 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------
