Created
August 27, 2017 09:26
-
-
Save alexander-somov/90e4fadc92e7e66c57940de6264ecb61 to your computer and use it in GitHub Desktop.
libstdc++ system_error failure sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <system_error> | |
using namespace std; | |
void Test1() { | |
const auto value = errc::no_such_file_or_directory; | |
const auto code = make_error_code(value); | |
cout << "value == code: " << (value == code) << "\n"; | |
} | |
void Test2() { | |
error_condition ec = make_error_condition(errc::no_such_file_or_directory); | |
auto ec2 = ec.category().default_error_condition(ec.value()); | |
auto ec3 = ec2.category().default_error_condition(ec.value()); | |
cout << ec3.category().name() << endl; | |
} | |
int main() { | |
Test1(); | |
Test2(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment