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 7
7
8
8
#include < hash.h>
9
9
#include < tinyformat.h>
10
- #include < util/strencodings.h>
11
10
#include < util/asmap.h>
11
+ #include < util/strencodings.h>
12
+ #include < util/string.h>
12
13
13
14
#include < algorithm>
14
15
#include < array>
@@ -50,13 +51,6 @@ void CNetAddr::SetIP(const CNetAddr& ipIn)
50
51
m_addr = ipIn.m_addr ;
51
52
}
52
53
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
-
60
54
void CNetAddr::SetLegacyIPv6 (Span<const uint8_t > ipv6)
61
55
{
62
56
assert (ipv6.size () == ADDR_IPV6_SIZE);
Original file line number Diff line number Diff line change 7
7
8
8
#include < attributes.h>
9
9
10
+ #include < algorithm>
11
+ #include < array>
10
12
#include < cstring>
11
13
#include < locale>
12
14
#include < sstream>
@@ -74,4 +76,15 @@ std::string ToString(const T& t)
74
76
return oss.str ();
75
77
}
76
78
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
+
77
90
#endif // BITCOIN_UTIL_STRENCODINGS_H
You can’t perform that action at this time.
0 commit comments