I am learning how the websocketpp
header-only library works, and I was quite perplexed by the lib::error_code
type that is sprinkled everywhere. Xcode would only reveal to me that the declaration of the type is in the <system_error>
header, which was somewhat confusing, because I saw that lib
is a websocketpp namespace.
Then eventually I find this in websocketpp/common/system_error.hpp
:
namespace websocketpp {
namespace lib {
#ifdef _WEBSOCKETPP_CPP11_SYSTEM_ERROR_
using std::error_code;
This is a using
inside of a namespace, which is not something that I understood.
What does this do? Does this simply alias websocketpp::lib::error_code
to be std::error_code
?
If so, why is this not delared as typedef std::error_code error_code
? That would make more sense to me.