putting in additional SFINAE guards in an effort to hunt down pesky and mysterious warnings

This commit is contained in:
Cheng 2023-09-22 20:35:28 +10:00
parent 9a12dbbd7e
commit 1b0d5148e8
No known key found for this signature in database
GPG Key ID: 571C3A9C3B9E6FCA

View File

@ -448,7 +448,10 @@ namespace ristretto255 {
} }
template<typename T> template<typename T>
ristretto255::hsh<hashsize>& operator << (const T& j) { typename std::enable_if<
ro::is_serializable<const T>::value,
ristretto255::hsh<hashsize>&
>::type operator << (const T& j) {
int i{ 1 }; int i{ 1 };
if constexpr (std::is_same_v<std::remove_cvref_t<T>, std::span<const byte> >) { if constexpr (std::is_same_v<std::remove_cvref_t<T>, std::span<const byte> >) {
i = crypto_generichash_blake2b_update( i = crypto_generichash_blake2b_update(
@ -464,7 +467,8 @@ namespace ristretto255 {
strlen(j) + 1 strlen(j) + 1
); );
} }
else if constexpr (is_serializable<const T>::value) { else {
static_assert(is_serializable<const T>::value, "don't know a machine and compiler independent representation of this type");
auto sj = ro::serialize(j); auto sj = ro::serialize(j);
i = crypto_generichash_blake2b_update( i = crypto_generichash_blake2b_update(
&(this->st), &(this->st),
@ -472,9 +476,6 @@ namespace ristretto255 {
sj.size() sj.size()
); );
} }
else {
static_assert(false, "don't know a machine and compiler independent representation of this type");
}
if (i) throw HashReuseException(); if (i) throw HashReuseException();
return *this; return *this;
} }