forked from qt-creator/qt-creator
Utils: Use span with initializer list
Make span even more useful as it can takes initializer lists. void foo(Utils::span<float> x); foo({1.2, 2.3}); Change-Id: Iaebbcad9dd875fbe0535b717941c6e0fc837303d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -6,8 +6,7 @@
|
|||||||
#include <qcompilerdetection.h>
|
#include <qcompilerdetection.h>
|
||||||
|
|
||||||
// The (Apple) Clang implementation of span is incomplete until LLVM 15 / Xcode 14.3 / macOS 13
|
// The (Apple) Clang implementation of span is incomplete until LLVM 15 / Xcode 14.3 / macOS 13
|
||||||
#if __cplusplus >= 202002L \
|
#ifdef __cpp_lib_span_initializer_list
|
||||||
&& !(defined(__apple_build_version__) && __apple_build_version__ < 14030022)
|
|
||||||
# include <span>
|
# include <span>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
@@ -28,7 +27,7 @@ QT_WARNING_PUSH
|
|||||||
// disable automatic usage of std::span in span-lite
|
// disable automatic usage of std::span in span-lite
|
||||||
// since we make that decision ourselves at the top of this header
|
// since we make that decision ourselves at the top of this header
|
||||||
# define span_CONFIG_SELECT_SPAN span_SPAN_NONSTD
|
# define span_CONFIG_SELECT_SPAN span_SPAN_NONSTD
|
||||||
|
# define span_FEATURE_WITH_INITIALIZER_LIST_P2447 1
|
||||||
# include <3rdparty/span/span.hpp>
|
# include <3rdparty/span/span.hpp>
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
using namespace nonstd;
|
using namespace nonstd;
|
||||||
|
Reference in New Issue
Block a user