GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::future_error(3) C++ Standard Libary std::future_error(3)

std::future_error - std::future_error


Defined in header <future>
class future_error; (since C++11)


The class std::future_error defines an exception object that is thrown on failure by
the functions in the thread library that deal with asynchronous execution and shared
states (std::future, std::promise, etc). Similar to std::system_error, this
exception carries an error code compatible with std::error_code.


std-future error-inheritance.svg


Inheritance diagram

Member functions


constructor creates a std::future_error object
(public member function)
operator= replaces the std::future_error object
(public member function)
code returns the error code
(public member function)
what returns the explanatory string specific to the error code
(public member function)

Inherited from std::logic_error

Inherited from std::exception

Member functions


destructor destroys the exception object
[virtual] (virtual public member function of std::exception)
what returns an explanatory string
[virtual] (virtual public member function of std::exception)

// Run this code


#include <future>
#include <iostream>


int main()
{
std::future<int> empty;
try {
int n = empty.get(); // The behavior is undefined, but
// some implementations throw std::future_error
} catch (const std::future_error& e) {
std::cout << "Caught a future_error with code \"" << e.code()
<< "\"\nMessage: \"" << e.what() << "\"\n";
}
}


Caught a future_error with code "future:3"
Message: "No associated state"


future_errc identifies the future error codes
(C++11) (enum)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.