Cajoled visual studio into issuing intelligent error messages
when an unserializable type is in the parameter pack.
This commit is contained in:
parent
dbe030ba21
commit
7ba674c29a
@ -195,10 +195,12 @@ namespace ristretto255 {
|
||||
if (i) throw HashReuseException();
|
||||
}
|
||||
template< has_machine_independent_representation T, typename... Args>explicit hash(const T& first, Args... args) {
|
||||
// not restraining the variant args by concept, because they get caught deeper in,
|
||||
// and visual studio reporting of variant concept errors sucks.
|
||||
hsh<hashsize> in;
|
||||
in << first;
|
||||
if constexpr (sizeof...(args) > 0) {
|
||||
in.hashinto( args...);
|
||||
in.hashinto( ro::trigger_error(args)...);
|
||||
}
|
||||
int i = crypto_generichash_blake2b_final(
|
||||
&in.st,
|
||||
|
@ -317,6 +317,9 @@
|
||||
template<typename... Args>
|
||||
concept has_machine_independent_representation = serializable<Args...>();
|
||||
|
||||
template<has_machine_independent_representation T>
|
||||
T trigger_error(T x) { return x; };
|
||||
|
||||
static_assert( !has_machine_independent_representation<double>
|
||||
&& has_machine_independent_representation<std::span<const byte>, char*, std::span<const char>>,
|
||||
"concepts needed");
|
||||
|
Loading…
Reference in New Issue
Block a user