From b5f15775674c4bcfa91052611428e48a10da3f84 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Thu, 23 May 2024 20:55:29 +0200 Subject: [PATCH] Added formattable concept --- include/fmt/base.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/fmt/base.h b/include/fmt/base.h index c840289572da8..48772c3a622de 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -149,6 +149,13 @@ import std; # define FMT_USE_NONTYPE_TEMPLATE_ARGS 0 #endif +// Detect C++20 concepts +#ifdef __cpp_concepts +# define FMT_USE_CONCEPTS 1 +#else +# define FMT_USE_CONCEPTS 0 +#endif + // Check if exceptions are disabled. #ifdef FMT_EXCEPTIONS // Use the provided definition. @@ -2007,6 +2014,11 @@ using is_formattable = bool_constant>() .map(std::declval()))>::value>; +#if FMT_USE_CONCEPTS +template +concept formattable = is_formattable, Char>::value; +#endif + /** \rst Constructs an object that stores references to arguments and can be implicitly