From 9a2b2ee8d6d325fc0d9ccf449fb375e78c6f3480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 20 Aug 2026 21:38:48 +0200 Subject: [PATCH] Avoid stamping out common type helpers in each templated test cases This provides small (but measurable) improvements in compilation times when a TU has multiple test cases templated over the same types. --- src/catch2/internal/catch_preprocessor.hpp | 74 +++++++++++++--------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/src/catch2/internal/catch_preprocessor.hpp b/src/catch2/internal/catch_preprocessor.hpp index fae95e9d..c112905d 100644 --- a/src/catch2/internal/catch_preprocessor.hpp +++ b/src/catch2/internal/catch_preprocessor.hpp @@ -9,6 +9,7 @@ #define CATCH_PREPROCESSOR_HPP_INCLUDED #include +#include #if defined(__GNUC__) // We need to silence "empty __VA_ARGS__ warning", and using just _Pragma does not work @@ -22,6 +23,34 @@ namespace Catch { struct priority_tag : priority_tag {}; template <> struct priority_tag<0> {}; + + // This is a bunch of helpers for the templated test case handling. + // They should live elsewhere in the long run, but as an in-between + // step we toss them all here. + template struct TypeList {}; + template + constexpr auto get_wrapper( priority_tag<1> ) noexcept -> TypeList { return {}; } + template