From 85db778c392d7041957e0c20625f8f8ed3ac9170 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 2 May 2021 08:29:14 +0100 Subject: [PATCH] c++20 concept: enforcing type for get_entropy implementers. --- src/pal/pal_concept.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pal/pal_concept.h b/src/pal/pal_concept.h index 62cdc07..bebd130 100644 --- a/src/pal/pal_concept.h +++ b/src/pal/pal_concept.h @@ -80,6 +80,12 @@ namespace snmalloc { PAL::register_for_low_memory_callback(pno) } -> ConceptSame; }; + template + concept ConceptPAL_get_entropy64 = requires() + { + { PAL::get_entropy64() } -> ConceptSame; + }; + /** * PALs ascribe to the conjunction of several concepts. These are broken * out by the shape of the requires() quantifiers required and by any @@ -91,6 +97,8 @@ namespace snmalloc ConceptPAL_static_members && ConceptPAL_error && ConceptPAL_memops && + (!pal_supports || + ConceptPAL_get_entropy64) && (!pal_supports || ConceptPAL_mem_low_notify) && (pal_supports ||