std::error_code, my_error::check_block == my_error::validate && my_error::accept_block == my_error::validate
问题 I'm using std::error_code and have a bunch of error's defined (using enum class) and registered. I have a very generic error now called my_error::validate, but want to provide more specific versions in my library. Generally people will want to use: if (ec == bc::error::validate) // ... However sometimes they may wish to see the specific error associated with that std::error_code or print the error message. // ec.message() says "check_block() failed to do XYZ" assert(ec == bc::error::check