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; }