<cuda/std/optional>#

2026-10-01

2 min read time

Applies to Linux and Windows

This page documents cuda::std::optional in libhipcxx, a vocabulary type that may or may not contain a value, available from C++14 onwards with constexpr support.

See the documentation of the standard header <optional>

Extensions#

  • All features are available from C++14 onwards.

  • All features are available at compile time if the value type supports it.

  • An implementation of P2988 optional<T&> is available by defining CCCL_ENABLE_OPTIONAL_REF.

Restrictions#

On device no exceptions are thrown in case of a bad access.