Adl Bridging

ADL bridging

In a previous section, we used the failure_info type to create the ADL bridge into the namespace where the ADL discovered throw_as_system_error_with_payload() function was to be found. Here we do the same, but more directly by creating a thin clone of std::error_code into the local namespace. This ensures that this namespace will be searched by the compiler when discovering the event hooks. namespace error_code_extended { // Use the error_code type as the ADL bridge for the hooks by creating a type here // It can be any type that your localised result uses, including the value type but // by localising the error code type here you prevent nasty surprises later when the // value type you use doesn't trigger the ADL bridge. »