summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenri Beauchamp <sldevel@users.noreply.github.com>2023-02-07 00:17:22 +0100
committerGitHub <noreply@github.com>2023-02-07 01:17:22 +0200
commit61b93e778bf58f6db4d2f3d8dd6ec67de25598ea (patch)
treeced38f38ab4e72f3d120d98f8f6632c65f2e1588
parentc1e1f1e423d6afa1b5f954296726a49e42a3fe74 (diff)
SL-19110 Make HBXXH* classes no-copy. (#72)
These classes are not trivially copyable because of the mState pointer on an internal XXH3 state that would have to be explicitely copied. While it would be possible to add custom copy constructor and operator for them, it does not really make sense to allow copying an instance of these classes, since all we care about storing and copying is the digest (which is either an U64 or an LLUUID).
-rw-r--r--indra/llcommon/hbxxh.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/indra/llcommon/hbxxh.h b/indra/llcommon/hbxxh.h
index 236716722a..9c0e9cf172 100644
--- a/indra/llcommon/hbxxh.h
+++ b/indra/llcommon/hbxxh.h
@@ -96,6 +96,15 @@ public:
}
}
+ // Make this class no-copy (it would be possible, with custom copy
+ // operators, but it is not trivially copyable, because of the mState
+ // pointer): it does not really make sense to allow copying it anyway,
+ // since all we care about is the resulting digest (so you should only
+ // need and care about storing/copying the digest and not a class
+ // instance).
+ HBXXH64(const HBXXH64&) noexcept = delete;
+ HBXXH64& operator=(const HBXXH64&) noexcept = delete;
+
~HBXXH64();
void update(const void* buffer, size_t len);
@@ -199,6 +208,15 @@ public:
}
}
+ // Make this class no-copy (it would be possible, with custom copy
+ // operators, but it is not trivially copyable, because of the mState
+ // pointer): it does not really make sense to allow copying it anyway,
+ // since all we care about is the resulting digest (so you should only
+ // need and care about storing/copying the digest and not a class
+ // instance).
+ HBXXH128(const HBXXH128&) noexcept = delete;
+ HBXXH128& operator=(const HBXXH128&) noexcept = delete;
+
~HBXXH128();
void update(const void* buffer, size_t len);