Namespaces
Variants

std::future_error:: future_error

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
future_error ( const future_error & other ) noexcept ;
(1) (自 C++11 起)
explicit future_error ( std:: future_errc ec ) ;
(2) (自 C++17 起)
1) 复制构造函数。使用 other 的内容初始化新 future_error 对象的内容。如果 * this other 都具有动态类型 std::future_error ,则满足 std:: strcmp ( what ( ) , other. what ( ) ) == 0
2) 构造一个新的 future_error 对象,其中包含错误码 std:: make_error_code ( ec )

参数

other - 用于复制的另一个 future_error 对象
ec - 错误代码

注释

在 C++17 之前,除了通过复制另一个 future_error 对象外,用户没有符合标准的方法来构造 future_error 。C++11 和 C++14 描述了一个仅用于说明的公开构造函数,该构造函数接受一个 std::error_code ,部分实现提供了这样的构造函数。