//===-- Standalone implementation of std::optional --------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_LIBC_SRC___SUPPORT_CPP_OPTIONAL_H #define LLVM_LIBC_SRC___SUPPORT_CPP_OPTIONAL_H #include "src/__support/CPP/type_traits.h" #include "src/__support/CPP/utility.h" #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" namespace LIBC_NAMESPACE_DECL { namespace cpp { // Trivial nullopt_t struct. struct nullopt_t { … }; // nullopt that can be used and returned. LIBC_INLINE_VAR constexpr nullopt_t nullopt{ … }; // This is very simple implementation of the std::optional class. It makes // several assumptions that the underlying type is trivially constructible, // copyable, or movable. template <typename T> class optional { … }; } // namespace cpp } // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC___SUPPORT_CPP_OPTIONAL_H