[system] - using error_code::new_category

Hello, It is not so clear for me how to use error_code::new_category. I've a library which uses two legacy libraries which have error codes (int) with the same value. How can I incorporate the error codes both libraries into boost::system? void f_calls_api_A() { int result( 0); if ( ( result = api_A_x() ) == -1) throw system_error( error_code( result, ...) ); // ? } void g_calls_api_B() { int result( 0); if ( ( result = api_B_y() ) == -1) throw system_error( error_code( result, ...) ); // ? } Void main() { try { f_calls_api_A(); g_calls_api_B(); } catch ( system_error const& e) { // how to know if it comes from A or B? } } Regards, Oliver
participants (1)
-
Oliver.Kowalke@qimonda.com