# std::experimental::nullopt_t

> C++ Atlas: `cppatlas.com/w/cpp/experimental/optional/nullopt_t` | Source: https://en.cppreference.com/w/cpp/experimental/optional/nullopt_t | Domain: Technical specifications | Standards: C++17

std::experimental::nullopt_t is an empty class type used to indicate optional type with uninitialized state.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <experimental/optional>
struct nullopt_t; // (library fundamentals TS)
```

`std::experimental::nullopt_t` is an empty class type used to indicate `optional` type with uninitialized state. In particular, `std::experimental::optional` has a constructor with `nullopt_t` as a single argument, which creates an optional that does not contain a value.

`std::experimental::nullopt_t` must be a *LiteralType* and cannot have a default constructor.

It must have a `constexpr` constructor that takes some implementation-defined literal type.

### Notes

`nullopt_t` is not *DefaultConstructible* to support both `op = {};` and `op = nullopt;` as the syntax for disengaging an optional object.

A possible implementation of this class is

```cpp
struct nullopt_t
{
    constexpr nullopt_t(int) {}
};
```

### See also

- [`nullopt`](https://en.cppreference.com/w/cpp/utility/optional/nullopt) (C++17): an object of type `nullopt_t` (constant)

---
Attribution: content from https://en.cppreference.com/w/cpp/experimental/optional/nullopt_t (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.