mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Fix build issues due to std::hash missing
This commit is contained in:
@@ -35,6 +35,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "cxxstd.h"
|
#include "cxxstd.h"
|
||||||
|
#if TINS_IS_CXX11
|
||||||
|
// std::hash
|
||||||
|
#include <memory>
|
||||||
|
#endif // TINS_IS_CXX11
|
||||||
|
|
||||||
namespace Tins {
|
namespace Tins {
|
||||||
namespace Internals {
|
namespace Internals {
|
||||||
|
|||||||
@@ -205,9 +205,7 @@ namespace std {
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct hash<Tins::IPv4Address> {
|
struct hash<Tins::IPv4Address> {
|
||||||
size_t operator()(const Tins::IPv4Address& addr) const {
|
size_t operator()(const Tins::IPv4Address& addr) const;
|
||||||
return std::hash<uint32_t>()(addr);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|||||||
@@ -223,9 +223,7 @@ namespace std {
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct hash<Tins::IPv6Address> {
|
struct hash<Tins::IPv6Address> {
|
||||||
size_t operator()(const Tins::IPv6Address& addr) const {
|
size_t operator()(const Tins::IPv6Address& addr) const;
|
||||||
return std::hash<std::string>()(addr.to_string());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|||||||
@@ -33,6 +33,10 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
#if TINS_IS_CXX11
|
||||||
|
// std::hash
|
||||||
|
#include <memory>
|
||||||
|
#endif // TINS_IS_CXX11
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -41,6 +45,7 @@
|
|||||||
#include "address_range.h"
|
#include "address_range.h"
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::ostringstream;
|
using std::ostringstream;
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
@@ -150,3 +155,8 @@ IPv4Address IPv4Address::operator&(const IPv4Address& mask) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // Tins
|
} // Tins
|
||||||
|
|
||||||
|
// Hash
|
||||||
|
size_t std::hash<Tins::IPv4Address>::operator()(const Tins::IPv4Address& addr) const {
|
||||||
|
return std::hash<uint32_t>()(addr);
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,6 +37,10 @@
|
|||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <mstcpip.h>
|
#include <mstcpip.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if TINS_IS_CXX11
|
||||||
|
// std::hash
|
||||||
|
#include <memory>
|
||||||
|
#endif // TINS_IS_CXX11
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -148,3 +152,8 @@ IPv6Address operator&(const IPv6Address& lhs, const IPv6Address& rhs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // Tins
|
} // Tins
|
||||||
|
|
||||||
|
// Hash
|
||||||
|
size_t std::hash<Tins::IPv6Address>::operator()(const Tins::IPv6Address& addr) const {
|
||||||
|
return std::hash<string>()(addr.to_string());
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user