From 62740e8e648f9b70ec0f6c78629b63c222cc842b Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sat, 4 May 2013 20:09:32 -0300 Subject: [PATCH] Implemented std::hash specialization for HWAddress. --- include/hw_address.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/hw_address.h b/include/hw_address.h index 38d4d51..353c07e 100644 --- a/include/hw_address.h +++ b/include/hw_address.h @@ -37,6 +37,7 @@ #include #include #include +#include "cxxstd.h" namespace Tins { /** @@ -319,5 +320,16 @@ void HWAddress::convert(const std::string &hw_addr, } } } -} +} // namespace Tins +#if TINS_IS_CXX11 +namespace std +{ +template +struct hash> { + size_t operator()(const Tins::HWAddress &addr) const { + return std::hash()(addr.to_string()); + } +}; +} // namespace std +#endif #endif // TINS_HWADDRESS_H