From 1b0d5148e8e345f6eba68f91148adb0df8fdb30a Mon Sep 17 00:00:00 2001 From: Cheng Date: Fri, 22 Sep 2023 20:35:28 +1000 Subject: [PATCH] putting in additional SFINAE guards in an effort to hunt down pesky and mysterious warnings --- src/ristretto255.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ristretto255.h b/src/ristretto255.h index 054b511..e2b350d 100644 --- a/src/ristretto255.h +++ b/src/ristretto255.h @@ -448,7 +448,10 @@ namespace ristretto255 { } template - ristretto255::hsh& operator << (const T& j) { + typename std::enable_if< + ro::is_serializable::value, + ristretto255::hsh& + >::type operator << (const T& j) { int i{ 1 }; if constexpr (std::is_same_v, std::span >) { i = crypto_generichash_blake2b_update( @@ -464,7 +467,8 @@ namespace ristretto255 { strlen(j) + 1 ); } - else if constexpr (is_serializable::value) { + else { + static_assert(is_serializable::value, "don't know a machine and compiler independent representation of this type"); auto sj = ro::serialize(j); i = crypto_generichash_blake2b_update( &(this->st), @@ -472,9 +476,6 @@ namespace ristretto255 { sj.size() ); } - else { - static_assert(false, "don't know a machine and compiler independent representation of this type"); - } if (i) throw HashReuseException(); return *this; }