Namespaces
Variants

Experimental library header <experimental/optional>

From cppreference.net
Standard library headers
Experimental library headers
Execution P2300
<experimental/execution>
Filesystem TS
<experimental/filesystem>
Parallelism TS (v1, v2)
experimental/algorithm
experimental/execution_policy
experimental/exception_list
experimental/numeric
<experimental/simd>
experimental/task_block
Library Fundamentals TS (v1, v2, v3)
experimental/algorithm
<experimental/any>
experimental/array
experimental/chrono
experimental/deque
experimental/forward_list
<experimental/functional>
experimental/future
experimental/iterator
experimental/list
experimental/map
experimental/memory
<experimental/memory_resource>
experimental/numeric
<experimental/optional>
experimental/propagate_const
experimental/random
experimental/ratio
experimental/regex
experimental/scope
experimental/set
experimental/source_location
experimental/string
<experimental/string_view>
experimental/system_error
experimental/tuple
experimental/type_traits
experimental/unordered_map
experimental/unordered_set
experimental/utility
experimental/vector

Concurrency TS
experimental/atomic
experimental/barrier
experimental/future
experimental/latch
Ranges TS
Coroutines TS
experimental/coroutine
Networking TS
experimental/buffer
experimental/executor
experimental/internet
experimental/io_context
<experimental/net>
experimental/netfwd
experimental/socket
experimental/timer
Reflection TS
<experimental/reflect>

このヘッダはLibrary Fundamentals TS ( v1 , v2 ) の一部です。

目次

翻訳の説明: - 「Contents」→「目次」に翻訳 - C++関連の専門用語(Classes、Functions、Comparison、Specialized algorithms、Hash support、Synopsis)は原文のまま保持 - HTMLタグ、属性、class名、id名は一切変更せず - 数値、構造、フォーマットは完全に保持

クラス

名前 説明
(library fundamentals TS)
オブジェクトを保持する場合と保持しない場合があるラッパー
(クラステンプレート)
(library fundamentals TS)
値を含まないoptionalへのチェック付きアクセスを示す例外
(クラス)
(library fundamentals TS)
optional型のインプレース構築のための曖昧性除去タグ型
(クラス)
std::hash アルゴリズムを特殊化する
(クラステンプレートの特殊化)
(library fundamentals TS)
初期化されていない状態のoptional型のインジケータ
(クラス)

関数

比較
optional オブジェクトを比較する
(関数テンプレート)
特殊化されたアルゴリズム
std::swap アルゴリズムを特殊化する
(関数)
optional オブジェクトを作成する
(関数テンプレート)
ハッシュサポート

概要

namespace std {
  namespace experimental {
  inline namespace fundamentals_v1 {
    // 5.4, オブジェクト型に対してオプショナル
    template <class T> class optional;
    // 5.5, インプレース構築
    struct in_place_t{};
    constexpr in_place_t in_place{};
    // 5.6, 非接続状態インジケータ
    struct nullopt_t{see below};
    constexpr nullopt_t nullopt(unspecified);
    // 5.7, クラス bad_optional_access
    class bad_optional_access;
    // 5.8, 関係演算子
    template <class T>
      constexpr bool operator==(const optional<T>&, const optional<T>&);
    template <class T>
      constexpr bool operator!=(const optional<T>&, const optional<T>&);
    template <class T>
      constexpr bool operator<(const optional<T>&, const optional<T>&);
    template <class T>
      constexpr bool operator>(const optional<T>&, const optional<T>&);
    template <class T>
      constexpr bool operator<=(const optional<T>&, const optional<T>&);
    template <class T>
      constexpr bool operator>=(const optional<T>&, const optional<T>&);
    // 5.9, nulloptとの比較
    template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
    template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
    template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
    template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
    template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
    template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
    template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
    template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
    template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
    template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
    template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
    template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
    // 5.10, Tとの比較
    template <class T> constexpr bool operator==(const optional<T>&, const T&);
    template <class T> constexpr bool operator==(const T&, const optional<T>&);
    template <class T> constexpr bool operator!=(const optional<T>&, const T&);
    template <class T> constexpr bool operator!=(const T&, const optional<T>&);
    template <class T> constexpr bool operator<(const optional<T>&, const T&);
    template <class T> constexpr bool operator<(const T&, const optional<T>&);
    template <class T> constexpr bool operator<=(const optional<T>&, const T&);
    template <class T> constexpr bool operator<=(const T&, const optional<T>&);
    template <class T> constexpr bool operator>(const optional<T>&, const T&);
    template <class T> constexpr bool operator>(const T&, const optional<T>&);
    template <class T> constexpr bool operator>=(const optional<T>&, const T&);
    template <class T> constexpr bool operator>=(const T&, const optional<T>&);
    // 5.11, 特殊化アルゴリズム
    template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
    template <class T> constexpr optional<see below> make_optional(T&&);
  } // namespace fundamentals_v1
  } // namespace experimental
  // 5.12, ハッシュサポート
  template <class T> struct hash;
  template <class T> struct hash<experimental::optional<T>>;
} // namespace std