---
name: "std::experimental::_Optional_base"
section: "3cxx"
platform: "linux"
package: "libstdc++-9-doc"
version: "9.3.0-22"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/std::experimental::_Optional_base"
---

# std::experimental::\_Optional\_base(3cxx)

Class template that holds the necessary state for Optional values and that has the responsibility for construction and the special members.

## NAME

std::experimental::\_Optional\_base\< \_Tp, \_ShouldProvideDestructor \> - Class template that holds the necessary state for **Optional values** and that has the responsibility for construction and the special members.

## SYNOPSIS

Inherited by **std::experimental::optional\< \_Tp \>**` [private]`.

### Public Member Functions

**\_Optional\_base** (**\_Optional\_base** &&\_\_other) noexcept(**is\_nothrow\_move\_constructible**\< \_Tp \>())\
 **\_Optional\_base** (const **\_Optional\_base** &\_\_other)\
 template\<typename... \_Args\> constexpr **\_Optional\_base** (**in\_place\_t**, \_Args &&... \_\_args)\
 template\<typename \_Up , typename... \_Args, enable\_if\_t\< is\_constructible\< \_Tp, initializer\_list\< \_Up \> &, \_Args &&... \>::value, int \> ...\> constexpr **\_Optional\_base** (**in\_place\_t**, **initializer\_list**\< \_Up \> \_\_il, \_Args &&... \_\_args)\
 constexpr **\_Optional\_base** (**nullopt\_t**) noexcept\
 **\_Optional\_base** & **operator=** (**\_Optional\_base** &&\_\_other) noexcept(\_\_and\_\< **is\_nothrow\_move\_constructible**\< \_Tp \>, **is\_nothrow\_move\_assignable**\< \_Tp \>\>())\
 **\_Optional\_base** & **operator=** (const **\_Optional\_base** &\_\_other)\

### Protected Member Functions

template\<typename... \_Args\> void **\_M\_construct** (\_Args &&... \_\_args) noexcept(**is\_nothrow\_constructible**\< \_Stored\_type, \_Args... \>())\
 void **\_M\_destruct** ()\
 constexpr const \_Tp & **\_M\_get** () const noexcept\
 constexpr \_Tp & **\_M\_get** () noexcept\
 constexpr bool **\_M\_is\_engaged** () const noexcept\
 void **\_M\_reset** ()\

## Detailed Description

### template\<typename \_Tp, bool \_ShouldProvideDestructor = !is\_trivially\_destructible\<\_Tp\>::value\>

class std::experimental::\_Optional\_base\< \_Tp, \_ShouldProvideDestructor \>" Class template that holds the necessary state for **Optional values** and that has the responsibility for construction and the special members.

Such a separate base class template is necessary in order to conditionally enable the special members (e.g. copy/move constructors). Note that this means that **\_Optional\_base** implements the functionality for copy and move assignment, but not for converting assignment.

**See also**

optional, \_Enable\_special\_members

Definition at line 202 of file optional.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
