名稱空間
變體
操作

實驗性庫標頭檔案 <experimental/optional>

來自 cppreference.com
 
 
標準庫標頭檔案
演算法
<algorithm>
<numeric>
字串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文字處理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
數值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
時間
<chrono> (C++11)
<ctime>
C 相容性
<ccomplex> (C++11/17/20*)
<ciso646> (until C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 
實驗性庫標頭檔案
執行 P2300
<experimental/execution>
檔案系統 TS
<experimental/filesystem>
並行性 TS (v1, v2)
experimental/algorithm
experimental/execution_policy
experimental/exception_list
experimental/numeric
<experimental/simd>
experimental/task_block
庫基礎 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

併發 TS
experimental/atomic
experimental/barrier
experimental/future
experimental/latch
範圍 TS
協程 TS
experimental/coroutine
網路 TS
experimental/buffer
experimental/executor
experimental/internet
experimental/io_context
<experimental/net>
experimental/netfwd
experimental/socket
experimental/timer
反射 TS
<experimental/reflect>
 

此標頭檔案是庫基礎 TS (v1, v2) 的一部分。

目錄

[編輯]

名稱 描述
(庫基礎 TS)
可能包含或不包含物件的包裝器
(類模板) [編輯]
(庫基礎 TS)
當檢查式訪問不包含值的 optional 時丟擲的異常
(類) [編輯]
(庫基礎 TS)
用於可選型別就地構造的消歧標籤型別
(類) [編輯]
特化 std::hash 演算法
(類模板特化) [編輯]
(庫基礎 TS)
指示未初始化狀態的可選型別
(類) [編輯]

[編輯] 函式

比較
比較 optional 物件
(函式模板) [編輯]
特化演算法
特化 std::swap 演算法
(函式) [編輯]
建立 optional 物件
(函式模板) [編輯]
雜湊支援

[編輯] 概要

namespace std {
  namespace experimental {
  inline namespace fundamentals_v1 {
 
    // 5.4, optional for object types
    template <class T> class optional;
 
    // 5.5, In-place construction
    struct in_place_t{};
    constexpr in_place_t in_place{};
 
    // 5.6, Disengaged state indicator
    struct nullopt_t{see below};
    constexpr nullopt_t nullopt(unspecified);
 
    // 5.7, Class bad_optional_access
    class bad_optional_access;
 
    // 5.8, Relational operators
    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, Comparison with 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, Comparison with 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, Specialized algorithms
    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, Hash support
  template <class T> struct hash;
  template <class T> struct hash<experimental::optional<T>>;
 
} // namespace std