summaryrefslogtreecommitdiff
path: root/zen/stl_tools.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2021-03-03 01:18:05 +0000
committerB Stack <bgstack15@gmail.com>2021-03-03 01:18:05 +0000
commit320f1ae680d73da35a0cfe4846eb687d8616bcac (patch)
tree6fb17404841b30822a2d9204e3e0932e55f05ebb /zen/stl_tools.h
parentMerge branch '11.6' into 'master' (diff)
parentadd upstream 11.7 (diff)
downloadFreeFileSync-320f1ae680d73da35a0cfe4846eb687d8616bcac.tar.gz
FreeFileSync-320f1ae680d73da35a0cfe4846eb687d8616bcac.tar.bz2
FreeFileSync-320f1ae680d73da35a0cfe4846eb687d8616bcac.zip
Merge branch '11.7' into 'master'11.7
add upstream 11.7 See merge request opensource-tracking/FreeFileSync!31
Diffstat (limited to 'zen/stl_tools.h')
-rw-r--r--zen/stl_tools.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/zen/stl_tools.h b/zen/stl_tools.h
index 495ff8d1..53b95241 100644
--- a/zen/stl_tools.h
+++ b/zen/stl_tools.h
@@ -128,7 +128,7 @@ void removeDuplicates(std::vector<T, Alloc>& v, CompLess less)
template <class T, class Alloc> inline
void removeDuplicates(std::vector<T, Alloc>& v)
{
- removeDuplicates(v, std::less<T>(), std::equal_to<T>());
+ removeDuplicates(v, std::less(), std::equal_to());
}
@@ -233,6 +233,7 @@ class FNV1aHash
{
public:
FNV1aHash() {}
+ explicit FNV1aHash(Num startVal) : hashVal_(startVal) {}
void add(Num n)
{
@@ -243,8 +244,8 @@ public:
Num get() const { return hashVal_; }
private:
- static_assert(IsUnsignedInt<Num>::value);
- static_assert(sizeof(Num) == 4 || sizeof(Num) == 8); //macOS: size_t is "unsigned long"
+ static_assert(IsUnsignedIntV<Num>);
+ static_assert(sizeof(Num) == 4 || sizeof(Num) == 8);
static constexpr Num base_ = sizeof(Num) == 4 ? 2166136261U : 14695981039346656037ULL;
static constexpr Num prime_ = sizeof(Num) == 4 ? 16777619U : 1099511628211ULL;
@@ -257,7 +258,7 @@ Num hashArray(ByteIterator first, ByteIterator last)
{
using ValType = typename std::iterator_traits<ByteIterator>::value_type;
static_assert(sizeof(ValType) <= sizeof(Num));
- static_assert(IsInteger<ValType>::value || std::is_same_v<ValType, char> || std::is_same_v<ValType, wchar_t>);
+ static_assert(IsIntegerV<ValType> || std::is_same_v<ValType, char> || std::is_same_v<ValType, wchar_t>);
FNV1aHash<Num> hash;
std::for_each(first, last, [&hash](ValType v) { hash.add(v); });
@@ -265,8 +266,7 @@ Num hashArray(ByteIterator first, ByteIterator last)
}
-//support for custom string classes in std::unordered_set/map
-struct StringHash
+struct StringHash //support for custom string classes with std::unordered_set/map
{
template <class String>
size_t operator()(const String& str) const
bgstack15