From d41775ecd78c1ae896c3e2cfaaa30ce80d78163b Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Sun, 6 Apr 2025 01:10:35 +0200 Subject: [PATCH] Utils: Use span with initializer list Make span even more useful as it can takes initializer lists. void foo(Utils::span x); foo({1.2, 2.3}); Change-Id: Iaebbcad9dd875fbe0535b717941c6e0fc837303d Reviewed-by: Eike Ziller --- src/libs/utils/span.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libs/utils/span.h b/src/libs/utils/span.h index f2c545940b7..3b716ae892e 100644 --- a/src/libs/utils/span.h +++ b/src/libs/utils/span.h @@ -6,9 +6,8 @@ #include // The (Apple) Clang implementation of span is incomplete until LLVM 15 / Xcode 14.3 / macOS 13 -#if __cplusplus >= 202002L \ - && !(defined(__apple_build_version__) && __apple_build_version__ < 14030022) -#include +#ifdef __cpp_lib_span_initializer_list +# include namespace Utils { using std::as_bytes; @@ -27,9 +26,9 @@ QT_WARNING_PUSH // disable automatic usage of std::span in span-lite // since we make that decision ourselves at the top of this header -#define span_CONFIG_SELECT_SPAN span_SPAN_NONSTD - -#include <3rdparty/span/span.hpp> +# define span_CONFIG_SELECT_SPAN span_SPAN_NONSTD +# define span_FEATURE_WITH_INITIALIZER_LIST_P2447 1 +# include <3rdparty/span/span.hpp> namespace Utils { using namespace nonstd;