File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 77
88#include < hash.h>
99#include < tinyformat.h>
10- #include < util/strencodings.h>
1110#include < util/asmap.h>
11+ #include < util/strencodings.h>
12+ #include < util/string.h>
1213
1314#include < algorithm>
1415#include < array>
@@ -50,13 +51,6 @@ void CNetAddr::SetIP(const CNetAddr& ipIn)
5051 m_addr = ipIn.m_addr ;
5152}
5253
53- template <typename T1, size_t PREFIX_LEN>
54- inline bool HasPrefix (const T1& obj, const std::array<uint8_t , PREFIX_LEN>& prefix)
55- {
56- return obj.size () >= PREFIX_LEN &&
57- std::equal (std::begin (prefix), std::end (prefix), std::begin (obj));
58- }
59-
6054void CNetAddr::SetLegacyIPv6 (Span<const uint8_t > ipv6)
6155{
6256 assert (ipv6.size () == ADDR_IPV6_SIZE);
Original file line number Diff line number Diff line change 77
88#include < attributes.h>
99
10+ #include < algorithm>
11+ #include < array>
1012#include < cstring>
1113#include < locale>
1214#include < sstream>
@@ -74,4 +76,15 @@ std::string ToString(const T& t)
7476 return oss.str ();
7577}
7678
79+ /* *
80+ * Check whether a container begins with the given prefix.
81+ */
82+ template <typename T1, size_t PREFIX_LEN>
83+ NODISCARD inline bool HasPrefix (const T1& obj,
84+ const std::array<uint8_t , PREFIX_LEN>& prefix)
85+ {
86+ return obj.size () >= PREFIX_LEN &&
87+ std::equal (std::begin (prefix), std::end (prefix), std::begin (obj));
88+ }
89+
7790#endif // BITCOIN_UTIL_STRENCODINGS_H
You can’t perform that action at this time.
0 commit comments