types: Use nonstd::span until we can guarantee c++20
Change-Id: Iaa0dcd69f2103f41f8badb86331fdc9c1b9544e7
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/meson.build b/src/meson.build
index ddaf341..046117b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -15,29 +15,19 @@
# span-lite might not have a pkg-config. It is header only so just make
# sure we can access the needed symbols from the header.
-span_dep = dependency('', required: false)
+span_dep = dependency('span-lite', required: false)
has_span = meson.get_compiler('cpp').has_header_symbol(
- 'span',
- 'std::dynamic_extent',
+ 'nonstd/span.hpp',
+ 'nonstd::dynamic_extent',
dependencies: span_dep,
required: false)
if not has_span
- span_dep = dependency('span-lite', required: false)
- has_span = meson.get_compiler('cpp').has_header_symbol(
- 'nonstd/span.hpp',
- 'nonstd::dynamic_extent',
- dependencies: span_dep,
+ span_lite_proj = import('cmake').subproject(
+ 'span-lite',
required: false)
- if not has_span
- span_lite_proj = import('cmake').subproject(
- 'span-lite',
- cmake_options: [
- ],
- required: false)
- if span_lite_proj.found()
- span_dep = span_lite_proj.dependency('span-lite')
- has_span = true
- endif
+ if span_lite_proj.found()
+ span_dep = span_lite_proj.dependency('span-lite')
+ has_span = true
endif
endif
diff --git a/src/stdplus/types.hpp b/src/stdplus/types.hpp
index 5ac3ed8..55d9735 100644
--- a/src/stdplus/types.hpp
+++ b/src/stdplus/types.hpp
@@ -1,8 +1,6 @@
#pragma once
-#if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
-#include <span>
-#define STDPLUS_SPAN_TYPE std::span
-#elif __has_include(<nonstd/span.hpp>)
+#if __has_include(<nonstd/span.hpp>)
+#define span_CONFIG_SELECT_SPAN span_SPAN_NONSTD
#include <nonstd/span.hpp>
#define STDPLUS_SPAN_TYPE nonstd::span
#endif