Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to convert a boost::system::error_code to a std:error_code?

Tags:

I want to replace external libraries (like boost) as much as possible with their equivalents in standard C++ if they exist and it is possible, to minimize dependencies, therefore I wonder if there exists a safe way to convert boost::system::error_code to std::error_code. Pseudo code example:

void func(const std::error_code & err)
{
    if(err) {
        //error
    } else {
        //success
    }
}

boost::system::error_code boost_err = foo(); //foo() returns a boost::system::error_code
std::error_code std_err = magic_code_here; //convert boost_err to std::error_code here
func(std_err);

The most important it is not the exactly the same error, just so close to as possible and at last if is an error or not. Are there any smart solutions?

Thanks in advance!