From 7fa111a68a2f9b564c75f31d6c4bb41923371e1e Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Sun, 30 Aug 2020 13:57:07 -0400 Subject: [PATCH] Yet more alternative styles --- _posts/2020-08-05-static-polymorphism.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/_posts/2020-08-05-static-polymorphism.md b/_posts/2020-08-05-static-polymorphism.md index f4ee2dc..557b340 100644 --- a/_posts/2020-08-05-static-polymorphism.md +++ b/_posts/2020-08-05-static-polymorphism.md @@ -232,6 +232,20 @@ concept ConstMethod = { a.unnecessary_const_method() } -> std::same_as; }; +// Can also use parentheses: +/* +template +concept ConstMethod = ( + requires (const T a) { + { a.const_method() } -> std::same_as; + } && + requires (T a) { + { a.nonconst_method() } -> std::same_as; + { a.unnecessary_const_method() } -> std::same_as; + } +); +*/ + // Formulated inside a `requires` block: /* template