]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: Use std::span instead of nonstd::span
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 3 Feb 2026 19:26:51 +0000 (20:26 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 3 Feb 2026 19:26:51 +0000 (20:26 +0100)
59 files changed:
.clang-format
LICENSE.adoc
cmake/Dependencies.cmake
cmake/FindNonstdSpan.cmake [deleted file]
doc/install.md
src/ccache/CMakeLists.txt
src/ccache/ccache.cpp
src/ccache/core/atomicfile.cpp
src/ccache/core/atomicfile.hpp
src/ccache/core/cacheentry.cpp
src/ccache/core/cacheentry.hpp
src/ccache/core/cacheentrydatareader.hpp
src/ccache/core/cacheentrydatawriter.hpp
src/ccache/core/manifest.cpp
src/ccache/core/manifest.hpp
src/ccache/core/result.cpp
src/ccache/core/result.hpp
src/ccache/core/resultextractor.cpp
src/ccache/core/resultextractor.hpp
src/ccache/core/resultinspector.cpp
src/ccache/core/resultinspector.hpp
src/ccache/core/resultretriever.cpp
src/ccache/core/resultretriever.hpp
src/ccache/core/serializer.hpp
src/ccache/hash.cpp
src/ccache/hash.hpp
src/ccache/storage/local/localstorage.cpp
src/ccache/storage/local/localstorage.hpp
src/ccache/storage/remote/client.cpp
src/ccache/storage/remote/client.hpp
src/ccache/storage/remote/filestorage.cpp
src/ccache/storage/remote/helper.cpp
src/ccache/storage/remote/httpstorage.cpp
src/ccache/storage/remote/redisstorage.cpp
src/ccache/storage/remote/remotestorage.hpp
src/ccache/storage/storage.cpp
src/ccache/storage/storage.hpp
src/ccache/util/bufferedipcchannelclient.hpp
src/ccache/util/bytes.cpp
src/ccache/util/bytes.hpp
src/ccache/util/conversion.hpp
src/ccache/util/file.cpp
src/ccache/util/file.hpp
src/ccache/util/ipcchannelclient.hpp
src/ccache/util/string.cpp
src/ccache/util/string.hpp
src/ccache/util/types.hpp
src/ccache/util/unixsocketclient.cpp
src/ccache/util/unixsocketclient.hpp
src/ccache/util/winnamedpipeclient.cpp
src/ccache/util/winnamedpipeclient.hpp
src/ccache/util/xxh3_128.hpp
src/ccache/util/zstd.cpp
src/ccache/util/zstd.hpp
src/third_party/CMakeLists.txt
src/third_party/nonstd-span/CMakeLists.txt [deleted file]
src/third_party/nonstd-span/nonstd/span.hpp [deleted file]
unittest/test_util_bytes.cpp
unittest/test_util_conversion.cpp

index 8adf2a179ed99085a7d37a0f35b74aea00bf58b7..48a1542189a44531c2e0c81948b6180a3ca30be3 100644 (file)
@@ -32,7 +32,7 @@ IncludeCategories:
   - Regex: '^<ccache/'
     Priority: 2
   # Dependency headers:
-  - Regex: '^<(blake3\.h|cxxurl/url\.hpp|doctest/.*|fmt/.*|hiredis/.*|httplib\.h|nonstd/.*|tl/expected\.hpp|xx(hash|h_x86dispatch)\.h|zstd\.h)>$'
+  - Regex: '^<(blake3\.h|cxxurl/url\.hpp|doctest/.*|fmt/.*|hiredis/.*|httplib\.h|tl/expected\.hpp|xx(hash|h_x86dispatch)\.h|zstd\.h)>$'
     Priority: 3
   # System headers:
   - Regex: '\.h.*>$'
index b8c14187443e6727c2eee3472f944968a75890c8..0984247a07f30dde5cacf2bb62eacd498dea15d9 100644 (file)
@@ -484,41 +484,6 @@ without including the above copyright and permission notices.
 ----
 
 
-=== src/third_party/nonstd-span/nonstd/span.hpp
-
-This is the single header version of
-https://github.com/martinmoene/span-lite[span-lite] 0.11.0 with the
-following license:
-
-----
-Copyright (c) 2018-2021 Martin Moene
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-----
-
-
 === src/third_party/tl-expected/tl/expected.hpp
 
 This is https://github.com/TartanLlama/expected[TartanLlama expected] 1.3.1 with
index ba0605cc9c7055aa35aada423d03b8744815d775..7c87fc2693fe930ffdee2e92925430e4f4dda78b 100644 (file)
@@ -25,7 +25,6 @@ if(HTTP_STORAGE_BACKEND)
   find_package(CppHttplib 0.10.6 MODULE REQUIRED)
 endif()
 find_package(Fmt 8.0.0 MODULE REQUIRED)
-find_package(NonstdSpan 0.10.3 MODULE REQUIRED)
 find_package(TlExpected 1.1.0 MODULE REQUIRED)
 find_package(Xxhash 0.8.0 MODULE REQUIRED)
 find_package(Zstd 1.3.4 MODULE REQUIRED)
diff --git a/cmake/FindNonstdSpan.cmake b/cmake/FindNonstdSpan.cmake
deleted file mode 100644 (file)
index c15bb85..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-mark_as_advanced(NONSTDSPAN_INCLUDE_DIR)
-
-if(DEP_NONSTDSPAN STREQUAL "BUNDLED")
-  message(STATUS "Using bundled NonstdSpan as requested")
-else()
-  find_path(NONSTDSPAN_INCLUDE_DIR nonstd/span.hpp)
-  if(NONSTDSPAN_INCLUDE_DIR)
-    file(READ "${NONSTDSPAN_INCLUDE_DIR}/nonstd/span.hpp" _nonstdspan_h)
-    string(REGEX MATCH "#define span_lite_MAJOR ([0-9]+).*#define span_lite_MINOR ([0-9]+).*#define span_lite_PATCH ([0-9]+)" _ "${_nonstdspan_h}")
-    set(_nonstdspan_version_string "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
-    if(NOT "${CMAKE_MATCH_0}" STREQUAL "" AND "${_nonstdspan_version_string}" VERSION_GREATER_EQUAL "${NonstdSpan_FIND_VERSION}")
-      message(STATUS "Using system NonstdSpan (${NONSTDSPAN_INCLUDE_DIR}/nonstd/span.hpp)")
-      add_library(dep_nonstdspan INTERFACE IMPORTED)
-      target_include_directories(dep_nonstdspan INTERFACE "${NONSTDSPAN_INCLUDE_DIR}")
-      register_dependency(NonstdSpan "SYSTEM (${NONSTDSPAN_INCLUDE_DIR}/nonstd/span.hpp)" ${_nonstdspan_version_string})
-    endif()
-  endif()
-  if(NOT TARGET dep_nonstdspan)
-    message(STATUS "Using bundled NonstdSpan since NonstdSpan>=${NonstdSpan_FIND_VERSION} was not found locally")
-  endif()
-endif()
index c92ed95f93be0dd3d9c98e65f24f29ec0183d8fb..c190cdcfd353eb6f010f5ec94108b930d96ddb53 100644 (file)
@@ -44,7 +44,6 @@ should be located or retrieved:
 
 - [BLAKE3](https://github.com/BLAKE3-team/BLAKE3)[^1]
 - [fmt](https://fmt.dev)[^1]
-- [span-lite](https://github.com/martinmoene/span-lite)[^1]
 - [tl-expected](https://github.com/TartanLlama/expected)[^1]
 - [xxhash](https://github.com/Cyan4973/xxHash)[^2]
 - [Zstandard](https://github.com/facebook/zstd)[^2]
index 34c1e56a425f82376dd37e1d4af58d48060ae76a..1fce20857960a52245c50abafc6ccc5fa07ae49b 100644 (file)
@@ -46,7 +46,6 @@ target_link_libraries(
     dep_blake3
     dep_cxxurl
     dep_fmt
-    dep_nonstdspan
     dep_tlexpected
     dep_xxhash
   PRIVATE
index 51db104c2d751a3d66e6e49c9097a07069ae0cba..391afa94b91da49d59c39603bc1938f1f79e92ab 100644 (file)
@@ -68,6 +68,8 @@
 #include <ccache/util/umaskscope.hpp>
 #include <ccache/util/wincompat.hpp>
 
+#include <tl/expected.hpp>
+
 #include <fcntl.h>
 
 #include <optional>
@@ -77,9 +79,6 @@
 #  include <unistd.h>
 #endif
 
-#include <nonstd/span.hpp>
-#include <tl/expected.hpp>
-
 #include <algorithm>
 #include <cerrno>
 #include <cstdint>
@@ -88,6 +87,7 @@
 #include <cstring>
 #include <ctime>
 #include <initializer_list>
+#include <span>
 #include <tuple>
 #include <unordered_map>
 #include <utility>
@@ -872,7 +872,7 @@ do_execute(Context& ctx, util::Args& args, const bool capture_stdout = true)
 }
 
 static void
-read_manifest(Context& ctx, nonstd::span<const uint8_t> cache_entry_data)
+read_manifest(Context& ctx, std::span<const uint8_t> cache_entry_data)
 {
   try {
     core::CacheEntry cache_entry(cache_entry_data);
index 5c402c4624666876c072d3ddfe843f367776c16d..26287a73b1fd3393ada9cb11a9b6cba0e3511ac2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -58,7 +58,7 @@ AtomicFile::write(std::string_view data)
 }
 
 void
-AtomicFile::write(nonstd::span<const uint8_t> data)
+AtomicFile::write(std::span<const uint8_t> data)
 {
   if (fwrite(data.data(), data.size(), 1, m_stream) != 1) {
     throw core::Error(
index d036887d19f641973095100a38930a4c16987955..41376b17a6f591106e4fc4d8dfdf00a1199fdef4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 
 #pragma once
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <cstdio>
 #include <filesystem>
+#include <span>
 #include <string_view>
 
 namespace core {
@@ -40,7 +39,7 @@ public:
   FILE* stream();
 
   void write(std::string_view data);
-  void write(nonstd::span<const uint8_t> data);
+  void write(std::span<const uint8_t> data);
   void flush();
 
   // Close the temporary file and rename it to the destination file. Note: The
index fff72625db77281d9256539e05e4941342fd7db8..8ea8488f444a09a89d64144c8059e0732604c9a4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -107,7 +107,7 @@ CacheEntry::Header::Header(const Config& config,
   }
 }
 
-CacheEntry::Header::Header(nonstd::span<const uint8_t> data)
+CacheEntry::Header::Header(std::span<const uint8_t> data)
 {
   parse(data);
 }
@@ -138,7 +138,7 @@ CacheEntry::Header::inspect() const
 }
 
 void
-CacheEntry::Header::parse(nonstd::span<const uint8_t> data)
+CacheEntry::Header::parse(std::span<const uint8_t> data)
 {
   CacheEntryDataReader reader(data);
   reader.read_int(magic);
@@ -194,7 +194,7 @@ CacheEntry::Header::uncompressed_payload_size() const
                                - k_epilogue_fields_size);
 }
 
-CacheEntry::CacheEntry(nonstd::span<const uint8_t> data)
+CacheEntry::CacheEntry(std::span<const uint8_t> data)
   : m_header(data)
 {
   const size_t non_payload_size =
@@ -244,12 +244,12 @@ CacheEntry::header() const
   return m_header;
 }
 
-nonstd::span<const uint8_t>
+std::span<const uint8_t>
 CacheEntry::payload() const
 {
   return m_header.compression_type == CompressionType::none
            ? m_payload
-           : nonstd::span<const uint8_t>(m_uncompressed_payload);
+           : std::span<const uint8_t>(m_uncompressed_payload);
 }
 
 util::Bytes
@@ -278,7 +278,7 @@ CacheEntry::serialize(const CacheEntry::Header& header,
 
 util::Bytes
 CacheEntry::serialize(const CacheEntry::Header& header,
-                      nonstd::span<const uint8_t> payload)
+                      std::span<const uint8_t> payload)
 {
   return do_serialize(
     header,
index 1eb49f97332315d59a4d27968848d296917a8091..0f989dc678ea38409867b01719a80490e7d2a005 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/core/types.hpp>
 #include <ccache/util/bytes.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <filesystem>
 #include <functional>
+#include <span>
 #include <string>
 
 // Cache entry format
@@ -73,7 +72,7 @@ public:
   {
   public:
     Header(const Config& config, CacheEntryType entry_type);
-    explicit Header(nonstd::span<const uint8_t> data);
+    explicit Header(std::span<const uint8_t> data);
     explicit Header(const std::filesystem::path& path);
 
     std::string inspect() const;
@@ -94,25 +93,25 @@ public:
     uint32_t uncompressed_payload_size() const;
 
   private:
-    void parse(nonstd::span<const uint8_t> data);
+    void parse(std::span<const uint8_t> data);
   };
 
-  explicit CacheEntry(nonstd::span<const uint8_t> data);
+  explicit CacheEntry(std::span<const uint8_t> data);
 
   void verify_checksum() const;
   const Header& header() const;
 
   // Return uncompressed payload.
-  nonstd::span<const uint8_t> payload() const;
+  std::span<const uint8_t> payload() const;
 
   static util::Bytes serialize(const Header& header,
                                Serializer& payload_serializer);
   static util::Bytes serialize(const Header& header,
-                               nonstd::span<const uint8_t> payload);
+                               std::span<const uint8_t> payload);
 
 private:
   Header m_header;
-  nonstd::span<const uint8_t> m_payload; // Potentially compressed
+  std::span<const uint8_t> m_payload; // Potentially compressed
   util::Bytes m_checksum;
 
   mutable util::Bytes m_uncompressed_payload;
index 077c4150c69a2462148f885040ad0aa0c62432d2..5886e85711decd36bd6156687c4ac9c701d054af 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -23,9 +23,8 @@
 #include <ccache/util/format.hpp>
 #include <ccache/util/string.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstddef>
+#include <span>
 #include <string_view>
 
 namespace core {
@@ -33,14 +32,14 @@ namespace core {
 class CacheEntryDataReader
 {
 public:
-  CacheEntryDataReader(nonstd::span<const uint8_t> data);
+  CacheEntryDataReader(std::span<const uint8_t> data);
 
   // Read `size` bytes. Throws `core::Error` on failure.
-  nonstd::span<const uint8_t> read_bytes(size_t size);
+  std::span<const uint8_t> read_bytes(size_t size);
 
   // Read and copy `buffer.size()` bytes into `buffer`. Throws `core::Error` on
   // failure.
-  void read_and_copy_bytes(nonstd::span<uint8_t> buffer);
+  void read_and_copy_bytes(std::span<uint8_t> buffer);
 
   // Read a string of length `length`. Throws `core::Error` on failure.
   std::string_view read_str(size_t length);
@@ -52,16 +51,15 @@ public:
   template<typename T> void read_int(T& value);
 
 private:
-  nonstd::span<const uint8_t> m_data;
+  std::span<const uint8_t> m_data;
 };
 
-inline CacheEntryDataReader::CacheEntryDataReader(
-  nonstd::span<const uint8_t> data)
+inline CacheEntryDataReader::CacheEntryDataReader(std::span<const uint8_t> data)
   : m_data(data)
 {
 }
 
-inline nonstd::span<const uint8_t>
+inline std::span<const uint8_t>
 CacheEntryDataReader::read_bytes(size_t size)
 {
   if (size > m_data.size()) {
@@ -74,7 +72,7 @@ CacheEntryDataReader::read_bytes(size_t size)
 }
 
 inline void
-CacheEntryDataReader::read_and_copy_bytes(nonstd::span<uint8_t> buffer)
+CacheEntryDataReader::read_and_copy_bytes(std::span<uint8_t> buffer)
 {
   const auto span = read_bytes(buffer.size());
   memcpy(buffer.data(), span.data(), span.size());
index 712a95753d7bb1df27825c020c477dc16d4540ef..adedc5ba1e01771ea1d0f2b78fafae5607063a6d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/util/format.hpp>
 #include <ccache/util/string.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstddef>
 #include <cstring>
+#include <span>
 #include <string_view>
 
 namespace core {
@@ -37,7 +36,7 @@ public:
   CacheEntryDataWriter(util::Bytes& output);
 
   // Write `data`. Throws `core::Error` on failure.
-  void write_bytes(nonstd::span<const uint8_t> data);
+  void write_bytes(std::span<const uint8_t> data);
 
   // Write `data`. Throws `core::Error` on failure.
   void write_str(std::string_view data);
@@ -55,7 +54,7 @@ inline CacheEntryDataWriter::CacheEntryDataWriter(util::Bytes& output)
 }
 
 inline void
-CacheEntryDataWriter::write_bytes(nonstd::span<const uint8_t> data)
+CacheEntryDataWriter::write_bytes(std::span<const uint8_t> data)
 {
   m_output.insert(m_output.end(), data);
 }
index d2b84bef6e60606186c030439165d251b278915a..14d91f2d413a6b7345536a5390de5353e58f98a5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2009-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -86,7 +86,7 @@ namespace core {
 const uint8_t Manifest::k_format_version = 1;
 
 void
-Manifest::read(nonstd::span<const uint8_t> data)
+Manifest::read(std::span<const uint8_t> data)
 {
   std::vector<std::string> files;
   std::vector<FileInfo> file_infos;
index 10753c0edd8936b7ab1bed3ca41bcf2ead575331..76e1d56b741e26a3b9c6d83aae92864c2293fc8b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2009-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/util/bytes.hpp>
 #include <ccache/util/time.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <cstdio>
 #include <functional>
 #include <optional>
+#include <span>
 #include <string>
 #include <unordered_map>
 #include <vector>
@@ -53,7 +52,7 @@ public:
 
   Manifest() = default;
 
-  void read(nonstd::span<const uint8_t> data);
+  void read(std::span<const uint8_t> data);
 
   std::optional<Hash::Digest> look_up_result_digest(const Context& ctx) const;
 
index 47a174d482af454b298485acee1b8e8b16597679..035d85c4ff8c3928bef115ef8dc70e3498cecfc3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -179,7 +179,7 @@ gcno_file_in_unmangled_form(const Context& ctx)
   return util::with_extension(ctx.args_info.output_obj, ".gcno");
 }
 
-Deserializer::Deserializer(nonstd::span<const uint8_t> data)
+Deserializer::Deserializer(std::span<const uint8_t> data)
   : m_data(data)
 {
 }
@@ -246,7 +246,7 @@ Serializer::Serializer(const Config& config)
 }
 
 void
-Serializer::add_data(const FileType file_type, nonstd::span<const uint8_t> data)
+Serializer::add_data(const FileType file_type, std::span<const uint8_t> data)
 {
   m_serialized_size += 1 + 1 + 8; // marker + file_type + file_size
   m_serialized_size += data.size();
@@ -298,7 +298,7 @@ Serializer::serialize(util::Bytes& output)
       is_file_entry
         ? DirEntry(std::get<std::string>(entry.data), DirEntry::LogOnError::yes)
             .size()
-        : std::get<nonstd::span<const uint8_t>>(entry.data).size();
+        : std::get<std::span<const uint8_t>>(entry.data).size();
 
     LOG("Storing {} entry #{} {} ({} bytes){}",
         store_raw ? "raw" : "embedded",
@@ -322,7 +322,7 @@ Serializer::serialize(util::Bytes& output)
         util::read_file<util::Bytes>(path), FMT("Failed to read {}: ", path));
       writer.write_bytes(data);
     } else {
-      writer.write_bytes(std::get<nonstd::span<const uint8_t>>(entry.data));
+      writer.write_bytes(std::get<std::span<const uint8_t>>(entry.data));
     }
 
     ++file_number;
index eb4aa464430497dfd48944e5f79528f70c96057a..f46cb82c1b3b8e379c985f803a56eba31765c82c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/core/serializer.hpp>
 #include <ccache/util/bytes.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <filesystem>
+#include <span>
 #include <string>
 #include <variant>
 #include <vector>
@@ -108,7 +107,7 @@ class Deserializer
 {
 public:
   // Read a result from `data`.
-  Deserializer(nonstd::span<const uint8_t> data);
+  Deserializer(std::span<const uint8_t> data);
 
   struct Header
   {
@@ -125,7 +124,7 @@ public:
 
     virtual void on_embedded_file(uint8_t file_number,
                                   FileType file_type,
-                                  nonstd::span<const uint8_t> data) = 0;
+                                  std::span<const uint8_t> data) = 0;
     virtual void on_raw_file(uint8_t file_number,
                              FileType file_type,
                              uint64_t file_size) = 0;
@@ -135,7 +134,7 @@ public:
   void visit(Visitor& visitor) const;
 
 private:
-  nonstd::span<const uint8_t> m_data;
+  std::span<const uint8_t> m_data;
 
   void parse_file_entry(CacheEntryDataParser& parser,
                         uint8_t file_number) const;
@@ -154,7 +153,7 @@ public:
 
   // Register data to include in the result. The data must live until
   // serialize() has been called.
-  void add_data(FileType file_type, nonstd::span<const uint8_t> data);
+  void add_data(FileType file_type, std::span<const uint8_t> data);
 
   // Register a file path whose content should be included in the result.
   [[nodiscard]] bool add_file(FileType file_type,
@@ -182,7 +181,7 @@ private:
   struct FileEntry
   {
     FileType file_type;
-    std::variant<nonstd::span<const uint8_t>, std::string> data;
+    std::variant<std::span<const uint8_t>, std::string> data;
   };
   std::vector<FileEntry> m_file_entries;
 
index 629546fa3301df8aee01ad3a7aa25ac9f6904c8b..7f53072bf7727931d3ce9c1f62dd92ab4637a07e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -50,7 +50,7 @@ ResultExtractor::ResultExtractor(
 void
 ResultExtractor::on_embedded_file(uint8_t /*file_number*/,
                                   result::FileType file_type,
-                                  nonstd::span<const uint8_t> data)
+                                  std::span<const uint8_t> data)
 {
   std::string suffix = result::file_type_to_string(file_type);
   if (suffix == result::k_unknown_file_type) {
index 0b5ff3435b929d82eefea6210e0dcfc2dd2e835d..fc04b8621e76cc46004860ffb8933f760d36fe46 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 
 #include <ccache/core/result.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <filesystem>
 #include <functional>
 #include <optional>
+#include <span>
 #include <string>
 
 namespace core {
@@ -44,7 +43,7 @@ public:
 
   void on_embedded_file(uint8_t file_number,
                         result::FileType file_type,
-                        nonstd::span<const uint8_t> data) override;
+                        std::span<const uint8_t> data) override;
   void on_raw_file(uint8_t file_number,
                    result::FileType file_type,
                    uint64_t file_size) override;
index 8ac5ab46fdd5b54c2334947066924277634188e7..f6520390b48e29abeb4fa6c2880e58af0b8fd0e8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -39,7 +39,7 @@ ResultInspector::on_header(const result::Deserializer::Header& header)
 void
 ResultInspector::on_embedded_file(uint8_t file_number,
                                   result::FileType file_type,
-                                  nonstd::span<const uint8_t> data)
+                                  std::span<const uint8_t> data)
 {
   PRINT(m_stream,
         "Embedded file #{}: {} ({} bytes)\n",
index 7307c19abbe72f4d7e0519865c9f8e958c8d1f49..cb3fb4958dd32a1dca843e028702411da7b1ed7a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 
 #include <ccache/core/result.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <cstdio>
+#include <span>
 
 namespace core {
 
@@ -37,7 +36,7 @@ public:
 
   void on_embedded_file(uint8_t file_number,
                         result::FileType file_type,
-                        nonstd::span<const uint8_t> data) override;
+                        std::span<const uint8_t> data) override;
   void on_raw_file(uint8_t file_number,
                    result::FileType file_type,
                    uint64_t file_size) override;
index 2f3f5c3567c3b89d29452d28fd0adf12b8281d09..2137acae7f248b3a9221e0e2c29563533a4921a3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -60,7 +60,7 @@ ResultRetriever::ResultRetriever(const Context& ctx,
 void
 ResultRetriever::on_embedded_file(uint8_t file_number,
                                   FileType file_type,
-                                  nonstd::span<const uint8_t> data)
+                                  std::span<const uint8_t> data)
 {
   LOG("Reading embedded entry #{} {} ({} bytes)",
       file_number,
@@ -218,7 +218,7 @@ ResultRetriever::get_dest_path(FileType file_type) const
 
 void
 ResultRetriever::write_dependency_file(const fs::path& path,
-                                       nonstd::span<const uint8_t> data)
+                                       std::span<const uint8_t> data)
 {
   ASSERT(m_ctx.args_info.dependency_target);
 
index cf04a21580a9b3adbedfcb625ae0bc9b0ddd9a9b..517967e881eb15f791c9326d1d278936dace47f6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/core/result.hpp>
 #include <ccache/hash.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <filesystem>
 #include <optional>
+#include <span>
 
 class Context;
 
@@ -48,7 +47,7 @@ public:
 
   void on_embedded_file(uint8_t file_number,
                         result::FileType file_type,
-                        nonstd::span<const uint8_t> data) override;
+                        std::span<const uint8_t> data) override;
   void on_raw_file(uint8_t file_number,
                    result::FileType file_type,
                    uint64_t file_size) override;
@@ -60,7 +59,7 @@ private:
   std::filesystem::path get_dest_path(result::FileType file_type) const;
 
   void write_dependency_file(const std::filesystem::path& path,
-                             nonstd::span<const uint8_t> data);
+                             std::span<const uint8_t> data);
 };
 
 } // namespace core
index 340c11bf22694309b4d080eda40650262b8b3e91..f9d21430b89d077ea6dbfbe816721884f3ba4021 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -20,9 +20,8 @@
 
 #include <ccache/util/bytes.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
+#include <span>
 
 namespace core {
 
index f56d9a8d86cd20eb7c9d0b94b6622a95a62ffedd..36785a359a5ad457083cd990f798858e8d34aa27 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -79,7 +79,7 @@ Hash::hash_delimiter(std::string_view type)
 }
 
 Hash&
-Hash::hash(nonstd::span<const uint8_t> data)
+Hash::hash(std::span<const uint8_t> data)
 {
   hash_buffer(data);
   add_debug_text(data);
@@ -114,7 +114,7 @@ Hash::hash_file(const fs::path& path)
 }
 
 void
-Hash::hash_buffer(nonstd::span<const uint8_t> buffer)
+Hash::hash_buffer(std::span<const uint8_t> buffer)
 {
   blake3_hasher_update(&m_hasher, buffer.data(), buffer.size());
   if (!buffer.empty() && m_debug_binary) {
@@ -129,7 +129,7 @@ Hash::hash_buffer(std::string_view buffer)
 }
 
 void
-Hash::add_debug_text(nonstd::span<const uint8_t> text)
+Hash::add_debug_text(std::span<const uint8_t> text)
 {
   if (!text.empty() && m_debug_text) {
     (void)fwrite(text.data(), 1, text.size(), m_debug_text);
index eebcd52fe7234c667fc9c287e68976be2af536d0..55b51943964080bf418208d3e2941f9f2d731470 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/util/path.hpp>
 
 #include <blake3.h>
-#include <nonstd/span.hpp>
 #include <tl/expected.hpp>
 
 #include <array>
 #include <cstdint>
 #include <cstdio>
 #include <filesystem>
+#include <span>
 #include <string>
 #include <string_view>
 
@@ -65,7 +65,7 @@ public:
   //
   // If hash debugging is enabled the bytes will be written verbatim to the text
   // input file, plus a final newline character.
-  Hash& hash(nonstd::span<const uint8_t> data);
+  Hash& hash(std::span<const uint8_t> data);
   Hash& hash(const char* data, size_t size);
   Hash& hash(const char* data);
   Hash& hash(std::string_view data);
@@ -95,10 +95,10 @@ private:
   FILE* m_debug_binary = nullptr;
   FILE* m_debug_text = nullptr;
 
-  void hash_buffer(nonstd::span<const uint8_t> buffer);
+  void hash_buffer(std::span<const uint8_t> buffer);
   void hash_buffer(std::string_view buffer);
 
-  void add_debug_text(nonstd::span<const uint8_t> text);
+  void add_debug_text(std::span<const uint8_t> text);
   void add_debug_text(std::string_view text);
 };
 
index c31c401c03172214f461e7d9539108dbac3448e7..eccfab6eb96264d951966d3bb9f8420484fb7c20 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -517,7 +517,7 @@ LocalStorage::get(const Hash::Digest& key, const core::CacheEntryType type)
 void
 LocalStorage::put(const Hash::Digest& key,
                   const core::CacheEntryType type,
-                  nonstd::span<const uint8_t> value,
+                  std::span<const uint8_t> value,
                   Overwrite overwrite)
 {
   const auto cache_file = look_up_cache_file(key, type);
index 5dc59856cd575b645342fb6d4bddac58fe98ef1b..76b5f2e4b12ee13d5e36449cbd85b380942b0302 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/util/longlivedlockfilemanager.hpp>
 #include <ccache/util/time.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <filesystem>
 #include <optional>
+#include <span>
 #include <string>
 #include <string_view>
 #include <utility>
@@ -74,7 +73,7 @@ public:
 
   void put(const Hash::Digest& key,
            core::CacheEntryType type,
-           nonstd::span<const uint8_t> value,
+           std::span<const uint8_t> value,
            Overwrite overwrite);
 
   void remove(const Hash::Digest& key, core::CacheEntryType type);
index a4eb69162e910799b8514faaaa278950205bb909..760f072c2682d3af2b3ca61ff9b4102ca77e90dd 100644 (file)
@@ -115,7 +115,7 @@ Client::has_capability(Capability cap) const
 }
 
 tl::expected<std::optional<util::Bytes>, Client::Error>
-Client::get(nonstd::span<const uint8_t> key)
+Client::get(std::span<const uint8_t> key)
 {
   if (!m_connected) {
     return tl::unexpected(Error(Failure::error, "Not connected"));
@@ -135,8 +135,8 @@ Client::get(nonstd::span<const uint8_t> key)
 }
 
 tl::expected<bool, Client::Error>
-Client::put(nonstd::span<const uint8_t> key,
-            nonstd::span<const uint8_t> value,
+Client::put(std::span<const uint8_t> key,
+            std::span<const uint8_t> value,
             PutFlags flags)
 {
   if (!m_connected) {
@@ -159,7 +159,7 @@ Client::put(nonstd::span<const uint8_t> key,
 }
 
 tl::expected<bool, Client::Error>
-Client::remove(nonstd::span<const uint8_t> key)
+Client::remove(std::span<const uint8_t> key)
 {
   if (!m_connected) {
     return tl::unexpected(Error(Failure::error, "Not connected"));
@@ -223,7 +223,7 @@ Client::read_greeting()
 }
 
 tl::expected<void, Client::Error>
-Client::send_bytes(nonstd::span<const uint8_t> data)
+Client::send_bytes(std::span<const uint8_t> data)
 {
   auto timeout = calculate_timeout();
   auto result = m_channel.send(data, timeout);
@@ -240,8 +240,8 @@ Client::receive_bytes(size_t count)
   size_t total_received = 0;
 
   while (total_received < count) {
-    nonstd::span<uint8_t> buffer(result.data() + total_received,
-                                 count - total_received);
+    std::span<uint8_t> buffer(result.data() + total_received,
+                              count - total_received);
     auto timeout = calculate_timeout();
     auto recv_result = m_channel.receive(buffer, timeout);
     if (!recv_result) {
@@ -290,7 +290,7 @@ Client::send_u64(uint64_t value)
 }
 
 tl::expected<void, Client::Error>
-Client::send_key(nonstd::span<const uint8_t> key)
+Client::send_key(std::span<const uint8_t> key)
 {
   DEBUG_ASSERT(key.size() < 256);
   auto key_len = static_cast<uint8_t>(key.size());
@@ -300,7 +300,7 @@ Client::send_key(nonstd::span<const uint8_t> key)
 }
 
 tl::expected<void, Client::Error>
-Client::send_value(nonstd::span<const uint8_t> value)
+Client::send_value(std::span<const uint8_t> value)
 {
   TRY(send_u64(value.size()));
   TRY(send_bytes(value));
index 28544e4b0848048e9d64de7f4f02fb4a16f1494c..d1bbdcbd14e37e1fa10be9e4f62e71172d091a38 100644 (file)
 #  include <ccache/util/unixsocketclient.hpp>
 #endif
 
-#include <nonstd/span.hpp>
 #include <tl/expected.hpp>
 
 #include <chrono>
 #include <cstdint>
 #include <optional>
+#include <span>
 #include <string>
 #include <vector>
 
@@ -89,11 +89,11 @@ public:
   bool has_capability(Capability cap) const;
 
   tl::expected<std::optional<util::Bytes>, Error>
-  get(nonstd::span<const uint8_t> key);
-  tl::expected<bool, Error> put(nonstd::span<const uint8_t> key,
-                                nonstd::span<const uint8_t> value,
+  get(std::span<const uint8_t> key);
+  tl::expected<bool, Error> put(std::span<const uint8_t> key,
+                                std::span<const uint8_t> value,
                                 PutFlags flags);
-  tl::expected<bool, Error> remove(nonstd::span<const uint8_t> key);
+  tl::expected<bool, Error> remove(std::span<const uint8_t> key);
   tl::expected<void, Error> stop();
 
   void close();
@@ -114,14 +114,14 @@ private:
   std::chrono::milliseconds calculate_timeout() const;
 
   tl::expected<void, Error> read_greeting();
-  tl::expected<void, Error> send_bytes(nonstd::span<const uint8_t> data);
+  tl::expected<void, Error> send_bytes(std::span<const uint8_t> data);
   tl::expected<util::Bytes, Error> receive_bytes(size_t count);
   tl::expected<uint8_t, Error> receive_u8();
   tl::expected<uint64_t, Error> receive_u64();
   tl::expected<void, Error> send_u8(uint8_t value);
   tl::expected<void, Error> send_u64(uint64_t value);
-  tl::expected<void, Error> send_key(nonstd::span<const uint8_t> key);
-  tl::expected<void, Error> send_value(nonstd::span<const uint8_t> value);
+  tl::expected<void, Error> send_key(std::span<const uint8_t> key);
+  tl::expected<void, Error> send_value(std::span<const uint8_t> value);
   tl::expected<std::optional<util::Bytes>, Error> receive_response_get();
   tl::expected<bool, Error> receive_response_bool();
   tl::expected<void, Error> receive_response_void();
index 8d8fc2b9b49948b0387ddbddfaa4870c9e4bbb3c..f3b8057392804ca407db896fa07e7402e4e1fd26 100644 (file)
@@ -53,7 +53,7 @@ public:
   get(const Hash::Digest& key) override;
 
   tl::expected<bool, Failure> put(const Hash::Digest& key,
-                                  nonstd::span<const uint8_t> value,
+                                  std::span<const uint8_t> value,
                                   Overwrite overwrite) override;
 
   tl::expected<bool, Failure> remove(const Hash::Digest& key) override;
@@ -139,7 +139,7 @@ FileStorageBackend::get(const Hash::Digest& key)
 
 tl::expected<bool, RemoteStorage::Backend::Failure>
 FileStorageBackend::put(const Hash::Digest& key,
-                        const nonstd::span<const uint8_t> value,
+                        const std::span<const uint8_t> value,
                         const Overwrite overwrite)
 {
   const auto path = get_entry_path(key);
index fbdd90d051beba96a053f8ee00ad6cf193807b90..e5e9a2d2edc12b51f29ec82edac4ffafe69e7080 100644 (file)
@@ -376,7 +376,7 @@ public:
   get(const Hash::Digest& key) override;
 
   tl::expected<bool, Failure> put(const Hash::Digest& key,
-                                  nonstd::span<const uint8_t> value,
+                                  std::span<const uint8_t> value,
                                   Overwrite overwrite) override;
 
   tl::expected<bool, Failure> remove(const Hash::Digest& key) override;
@@ -557,7 +557,7 @@ HelperBackend::get(const Hash::Digest& key)
 
 tl::expected<bool, RemoteStorage::Backend::Failure>
 HelperBackend::put(const Hash::Digest& key,
-                   nonstd::span<const uint8_t> value,
+                   std::span<const uint8_t> value,
                    Overwrite overwrite)
 {
   TRY(ensure_connected());
index 99dac9d90d058714ec484ce0ba9778aace1c2025..3bd85744d3ce2088928adb5a245cdb3f10b17e57 100644 (file)
@@ -48,7 +48,7 @@ public:
   get(const Hash::Digest& key) override;
 
   tl::expected<bool, Failure> put(const Hash::Digest& key,
-                                  nonstd::span<const uint8_t> value,
+                                  std::span<const uint8_t> value,
                                   Overwrite overwrite) override;
 
   tl::expected<bool, Failure> remove(const Hash::Digest& key) override;
@@ -195,7 +195,7 @@ HttpStorageBackend::get(const Hash::Digest& key)
 
 tl::expected<bool, RemoteStorage::Backend::Failure>
 HttpStorageBackend::put(const Hash::Digest& key,
-                        const nonstd::span<const uint8_t> value,
+                        const std::span<const uint8_t> value,
                         const Overwrite overwrite)
 {
   const auto url_path = get_entry_path(key);
index a2aa727a80083edacbeeaaf0664b5570ea955387..e632a77530998f1d265607726a7a7d3e915f26a2 100644 (file)
@@ -72,7 +72,7 @@ public:
   get(const Hash::Digest& key) override;
 
   tl::expected<bool, Failure> put(const Hash::Digest& key,
-                                  nonstd::span<const uint8_t> value,
+                                  std::span<const uint8_t> value,
                                   Overwrite overwrite) override;
 
   tl::expected<bool, Failure> remove(const Hash::Digest& key) override;
@@ -186,7 +186,7 @@ RedisStorageBackend::get(const Hash::Digest& key)
 
 tl::expected<bool, RemoteStorage::Backend::Failure>
 RedisStorageBackend::put(const Hash::Digest& key,
-                         nonstd::span<const uint8_t> value,
+                         std::span<const uint8_t> value,
                          Overwrite overwrite)
 {
   const auto key_string = get_key_string(key);
index 22bb4613818296ca4b7f2e0e1a537c8f15e80fe5..44208af5035b78bcfe6977171e9b39b0529278e8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/util/bytes.hpp>
 
 #include <cxxurl/url.hpp>
-#include <nonstd/span.hpp>
 #include <tl/expected.hpp>
 
 #include <chrono>
 #include <memory>
 #include <optional>
+#include <span>
 #include <stdexcept>
 #include <string>
 #include <vector>
@@ -83,7 +83,7 @@ public:
     // Put `value` associated to `key` in the storage. Returns true if the entry
     // was stored, otherwise false.
     virtual tl::expected<bool, Failure> put(const Hash::Digest& key,
-                                            nonstd::span<const uint8_t> value,
+                                            std::span<const uint8_t> value,
                                             Overwrite overwrite) = 0;
 
     // Remove `key` and its associated value. Returns true if the entry was
index 320874f57259546a3af96e8c8ea23ed2f1af181b..9d782404745f1e4d62da941002e8ad90f0030962 100644 (file)
@@ -460,7 +460,7 @@ Storage::get(const Hash::Hash::Digest& key,
 void
 Storage::put(const Hash::Digest& key,
              const core::CacheEntryType type,
-             nonstd::span<const uint8_t> value)
+             std::span<const uint8_t> value)
 {
   if (!m_config.remote_only()) {
     local.put(key, type, value, Overwrite::yes);
@@ -666,7 +666,7 @@ Storage::get_from_remote_storage(const Hash::Digest& key,
 
 void
 Storage::put_in_remote_storage(const Hash::Digest& key,
-                               nonstd::span<const uint8_t> value,
+                               std::span<const uint8_t> value,
                                Overwrite overwrite)
 {
   if (!core::CacheEntry::Header(value).self_contained) {
index c48987f8056738c4a145a82d36869ad5103b1ba8..dc0a699856e06b0adba21b4b3795599863c96fab 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 #include <ccache/storage/types.hpp>
 #include <ccache/util/bytes.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <filesystem>
 #include <functional>
 #include <memory>
+#include <span>
 #include <string>
 #include <string_view>
 #include <vector>
@@ -66,7 +65,7 @@ public:
 
   void put(const Hash::Digest& key,
            core::CacheEntryType type,
-           nonstd::span<const uint8_t> value);
+           std::span<const uint8_t> value);
 
   void remove(const Hash::Digest& key, core::CacheEntryType type);
 
@@ -94,7 +93,7 @@ private:
                                const EntryReceiver& entry_receiver);
 
   void put_in_remote_storage(const Hash::Digest& key,
-                             nonstd::span<const uint8_t> value,
+                             std::span<const uint8_t> value,
                              Overwrite overwrite);
 
   void remove_from_remote_storage(const Hash::Digest& key);
index 97980ea7f036fbbee347fb8b1112c71a39654ffa..2646f0e8aeecabe7ea07ae0278103ef7f672ecdb 100644 (file)
@@ -46,14 +46,14 @@ public:
   }
 
   tl::expected<void, IpcError>
-  send(nonstd::span<const uint8_t> data,
+  send(std::span<const uint8_t> data,
        const std::chrono::milliseconds& timeout) override
   {
     return m_transport.send(data, timeout);
   }
 
   tl::expected<size_t, IpcError>
-  receive(nonstd::span<uint8_t> buffer,
+  receive(std::span<uint8_t> buffer,
           const std::chrono::milliseconds& timeout) override
   {
     if (buffer.empty()) {
index 66d1e9fc04bfae5a8a41b82d0d62fbb13c0c794a..a5a2ecd4f8f40bbbe26e78ac3558f8b0e9cfc1d3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -81,7 +81,7 @@ Bytes::operator=(Bytes&& other) noexcept
 }
 
 Bytes&
-Bytes::operator=(nonstd::span<const uint8_t> data) noexcept
+Bytes::operator=(std::span<const uint8_t> data) noexcept
 {
   assign_from_data(this, data.data(), data.size());
   return *this;
index ba71cad0233b9e90d537b446c64f062af6d27293..d90fa0ccdba6820e987cab40b3bf90f2154bd96e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 
 #pragma once
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <cstring>
 #include <initializer_list>
 #include <memory>
+#include <span>
 #include <string_view>
 
 namespace util {
@@ -32,7 +31,7 @@ namespace util {
 //
 // The primary motivation for this class instead of just using
 // std::vector<uint8_t> is to make zero copying without zero-filling possible
-// when retrieving data from syscalls like read(2), i.e, when
+// when retrieving data from syscalls like read(2), i.e., when
 // std::vector::insert cannot be used.
 class Bytes
 {
@@ -42,7 +41,7 @@ public:
 
   Bytes(const void* data, size_t size) noexcept;
   Bytes(const void* first, const void* last) noexcept;
-  Bytes(nonstd::span<const uint8_t> data) noexcept;
+  Bytes(std::span<const uint8_t> data) noexcept;
   Bytes(std::string_view data) noexcept;
 
   Bytes(const Bytes& other) noexcept;
@@ -54,7 +53,7 @@ public:
 
   Bytes& operator=(const Bytes& other) noexcept;
   Bytes& operator=(Bytes&& other) noexcept;
-  Bytes& operator=(nonstd::span<const uint8_t> data) noexcept;
+  Bytes& operator=(std::span<const uint8_t> data) noexcept;
   Bytes& operator=(std::string_view data) noexcept;
 
   uint8_t operator[](size_t pos) const noexcept;
@@ -89,7 +88,7 @@ public:
 
   void insert(const void* pos, const void* first, const void* last) noexcept;
   void insert(const void* pos, const void* data, size_t size) noexcept;
-  void insert(const void* pos, nonstd::span<const uint8_t> data) noexcept;
+  void insert(const void* pos, std::span<const uint8_t> data) noexcept;
 
   void erase(const void* pos, size_t size) noexcept;
   void erase(const void* first, const void* last) noexcept;
@@ -118,7 +117,7 @@ inline Bytes::Bytes(const void* first, const void* last) noexcept
 {
 }
 
-inline Bytes::Bytes(nonstd::span<const uint8_t> data) noexcept
+inline Bytes::Bytes(std::span<const uint8_t> data) noexcept
   : Bytes(data.data(), data.size())
 {
 }
@@ -245,7 +244,7 @@ Bytes::insert(const void* pos, const void* first, const void* last) noexcept
 }
 
 inline void
-Bytes::insert(const void* pos, nonstd::span<const uint8_t> data) noexcept
+Bytes::insert(const void* pos, std::span<const uint8_t> data) noexcept
 {
   return insert(pos, &*data.begin(), data.size());
 }
index d64667808609880c4588882f4fe961cedd0449f7..fad44eb3b9b484b6ffa089e204c6539fa0864208 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2023-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2023-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 
 #include <ccache/util/bytes.hpp>
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <filesystem>
+#include <span>
 #include <string>
 #include <string_view>
 
@@ -45,18 +44,18 @@ template<typename T> void big_endian_to_int(const uint8_t* buffer, T& value);
 // - buffer: Buffer to write bytes to.
 template<typename T> void int_to_big_endian(T value, uint8_t* buffer);
 
-// Convert `data` to a `nonstd::span<const uint8_t>`.
-nonstd::span<const uint8_t> to_span(const void* data, size_t size);
+// Convert `data` to a `std::span<const uint8_t>`.
+std::span<const uint8_t> to_span(const void* data, size_t size);
 
-// Convert `value` to a `nonstd::span<const uint8_t>`.
-nonstd::span<const uint8_t> to_span(std::string_view value);
+// Convert `value` to a `std::span<const uint8_t>`.
+std::span<const uint8_t> to_span(std::string_view value);
 
 // Convert `value` to a string. This function is used when joining
 // `std::string`s with `util::join`.
 template<typename T> std::string to_string(const T& value);
 
 // Convert `data` to a `std::string_view`.
-std::string_view to_string_view(nonstd::span<const uint8_t> data);
+std::string_view to_string_view(std::span<const uint8_t> data);
 
 // --- Inline implementations ---
 
@@ -109,13 +108,13 @@ int_to_big_endian(int8_t value, uint8_t* buffer)
   buffer[0] = value;
 }
 
-inline nonstd::span<const uint8_t>
+inline std::span<const uint8_t>
 to_span(const void* data, size_t size)
 {
   return {reinterpret_cast<const uint8_t*>(data), size};
 }
 
-inline nonstd::span<const uint8_t>
+inline std::span<const uint8_t>
 to_span(std::string_view data)
 {
   return to_span(data.data(), data.size());
@@ -145,7 +144,7 @@ to_string(const std::string_view& sv)
 
 template<>
 inline std::string
-to_string(const nonstd::span<const uint8_t>& bytes)
+to_string(const std::span<const uint8_t>& bytes)
 {
   return std::string(to_string_view(bytes));
 }
@@ -165,7 +164,7 @@ to_string(const std::filesystem::path& path)
 }
 
 inline std::string_view
-to_string_view(nonstd::span<const uint8_t> data)
+to_string_view(std::span<const uint8_t> data)
 {
   return std::string_view(reinterpret_cast<const char*>(data.data()),
                           data.size());
index 4653e2478a4911e0b9751509739ac106dc6c29c0..1583e1e4388a622cda820d889acbaa85d0f5dd73 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -107,7 +107,7 @@ static tl::expected<void, std::string>
 copy_fd(int src_fd, int dst_fd)
 {
   std::optional<std::string> write_error;
-  auto read_result = read_fd(src_fd, [&](nonstd::span<const uint8_t> data) {
+  auto read_result = read_fd(src_fd, [&](std::span<const uint8_t> data) {
     auto result = write_fd(dst_fd, data.data(), data.size());
     if (!result) {
       write_error = result.error();
@@ -697,7 +697,7 @@ write_file(const fs::path& path, std::string_view data, WriteFileMode mode)
 
 tl::expected<void, std::string>
 write_file(const fs::path& path,
-           nonstd::span<const uint8_t> data,
+           std::span<const uint8_t> data,
            WriteFileMode mode)
 {
   util::PathString path_str(path);
index 107420df9d48ed763ae26f78513264d559336dea..bf4aa7021c9b2966e90d6173565b32eaf4769e75 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -23,7 +23,6 @@
 #include <ccache/util/time.hpp>
 #include <ccache/util/types.hpp>
 
-#include <nonstd/span.hpp>
 #include <tl/expected.hpp>
 
 #include <cstddef>
@@ -31,6 +30,7 @@
 #include <filesystem>
 #include <functional>
 #include <optional>
+#include <span>
 #include <string>
 #include <string_view>
 #include <system_error>
@@ -144,7 +144,7 @@ write_file(const std::filesystem::path& path,
 // Write binary `data` to `path`.
 tl::expected<void, std::string>
 write_file(const std::filesystem::path& path,
-           nonstd::span<const uint8_t> data,
+           std::span<const uint8_t> data,
            WriteFileMode mode = WriteFileMode::unlink);
 
 // --- Inline implementations ---
index 5380a76127482f2420815a3dc7aba419a82e312c..cce2f9cd7daf5183f77b4c26a654c82d82f609b6 100644 (file)
 
 #pragma once
 
-#include <nonstd/span.hpp>
 #include <tl/expected.hpp>
 
 #include <chrono>
+#include <span>
 #include <string>
 
 namespace util {
@@ -54,11 +54,11 @@ public:
           const std::chrono::milliseconds& timeout) = 0;
 
   virtual tl::expected<void, IpcError>
-  send(nonstd::span<const uint8_t> data,
+  send(std::span<const uint8_t> data,
        const std::chrono::milliseconds& timeout) = 0;
 
   virtual tl::expected<size_t, IpcError>
-  receive(nonstd::span<uint8_t> buffer,
+  receive(std::span<uint8_t> buffer,
           const std::chrono::milliseconds& timeout) = 0;
 
   virtual void close() = 0;
index 9026642258e43708ebdca5f542849fb7d4acdff0..423c0f4bf7465454904d16c5eca210d7c6f3a30c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -127,7 +127,7 @@ format_argv_for_logging(const char* const* argv)
 }
 
 std::string
-format_base16(nonstd::span<const uint8_t> data)
+format_base16(std::span<const uint8_t> data)
 {
   static const char digits[] = "0123456789abcdef";
   std::string result;
@@ -140,7 +140,7 @@ format_base16(nonstd::span<const uint8_t> data)
 }
 
 std::string
-format_base32hex(nonstd::span<const uint8_t> data)
+format_base32hex(std::span<const uint8_t> data)
 {
   static const char digits[] = "0123456789abcdefghijklmnopqrstuv";
   std::string result;
@@ -164,7 +164,7 @@ format_base32hex(nonstd::span<const uint8_t> data)
 }
 
 std::string
-format_legacy_digest(nonstd::span<const uint8_t> data)
+format_legacy_digest(std::span<const uint8_t> data)
 {
   const size_t base16_bytes = 2;
   ASSERT(data.size() >= base16_bytes);
index a5ee5bcd1605dba96a33324f51864ae005ace42c..bc27ded13d5c772542049200cf5c7b2a381c204e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -22,7 +22,6 @@
 #include <ccache/util/time.hpp>
 #include <ccache/util/tokenizer.hpp>
 
-#include <nonstd/span.hpp>
 #include <tl/expected.hpp>
 
 #include <sys/stat.h> // for mode_t
@@ -32,6 +31,7 @@
 #include <cstring>
 #include <filesystem>
 #include <optional>
+#include <span>
 #include <string>
 #include <string_view>
 #include <utility>
@@ -64,11 +64,11 @@ std::string format_argv_for_logging(const char* const* argv);
 
 // Format a hexadecimal string representing `data`. The returned string will be
 // `2 * data.size()` long.
-std::string format_base16(nonstd::span<const uint8_t> data);
+std::string format_base16(std::span<const uint8_t> data);
 
 // Format a lowercase base32hex string representing `data`. No padding
 // characters will be added.
-std::string format_base32hex(nonstd::span<const uint8_t> data);
+std::string format_base32hex(std::span<const uint8_t> data);
 
 // Format `ms` as a duration string.
 std::string format_duration(std::chrono::milliseconds ms);
@@ -83,7 +83,7 @@ std::string format_human_readable_diff(int64_t diff,
 // compatibility with the cleanup algorithm in older ccache versions and to
 // allow for up to four uniform cache levels. The rest are encoded as lowercase
 // base32hex digits without padding characters.
-std::string format_legacy_digest(nonstd::span<const uint8_t> data);
+std::string format_legacy_digest(std::span<const uint8_t> data);
 
 // Format `size` as a human-readable string.
 std::string format_human_readable_size(uint64_t size,
index e280afb13e140ef22f8a73733f572369660712c4..ca52205ae349ba1e54e32e9036e22ed0ef0c8a16 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 
 #pragma once
 
-#include <nonstd/span.hpp>
-
 #include <cstdint>
 #include <functional>
+#include <span>
 
 namespace util {
 
-using DataReceiver = std::function<void(nonstd::span<const uint8_t> data)>;
+using DataReceiver = std::function<void(std::span<const uint8_t> data)>;
 
 } // namespace util
index cedad6ca404c97f5a35614efbbd3efb1e57924f1..cd006d1e1e18e03ca4dc837d3c6d51d5ad2867a3 100644 (file)
@@ -129,7 +129,7 @@ UnixSocketClient::connect(const std::string& endpoint,
 }
 
 tl::expected<void, IpcError>
-UnixSocketClient::send(nonstd::span<const uint8_t> data,
+UnixSocketClient::send(std::span<const uint8_t> data,
                        const std::chrono::milliseconds& timeout)
 {
   if (m_fd == -1) {
@@ -188,7 +188,7 @@ UnixSocketClient::send(nonstd::span<const uint8_t> data,
 }
 
 tl::expected<size_t, IpcError>
-UnixSocketClient::receive(nonstd::span<uint8_t> buffer,
+UnixSocketClient::receive(std::span<uint8_t> buffer,
                           const std::chrono::milliseconds& timeout)
 {
   if (m_fd == -1) {
index 67435d44193ccf401f4516a8b70da37360aaf6cb..7d7d2e8642dc8860576fc7576f6c545db6f4801e 100644 (file)
@@ -37,11 +37,11 @@ public:
           const std::chrono::milliseconds& timeout) override;
 
   tl::expected<void, IpcError>
-  send(nonstd::span<const uint8_t> data,
+  send(std::span<const uint8_t> data,
        const std::chrono::milliseconds& timeout) override;
 
   tl::expected<size_t, IpcError>
-  receive(nonstd::span<uint8_t> buffer,
+  receive(std::span<uint8_t> buffer,
           const std::chrono::milliseconds& timeout) override;
 
   void close() override;
index 1d265161090310028a2a93fedb085c8087a74da1..e84d33cb784dac3ec9034b33f73d0106ac4ea758 100644 (file)
@@ -99,7 +99,7 @@ WinNamedPipeClient::connect(const std::string& endpoint,
 }
 
 tl::expected<void, IpcError>
-WinNamedPipeClient::send(nonstd::span<const uint8_t> data,
+WinNamedPipeClient::send(std::span<const uint8_t> data,
                          const std::chrono::milliseconds& timeout)
 {
   if (m_handle == INVALID_HANDLE_VALUE) {
@@ -191,7 +191,7 @@ WinNamedPipeClient::send(nonstd::span<const uint8_t> data,
 }
 
 tl::expected<size_t, IpcError>
-WinNamedPipeClient::receive(nonstd::span<uint8_t> buffer,
+WinNamedPipeClient::receive(std::span<uint8_t> buffer,
                             const std::chrono::milliseconds& timeout)
 {
   if (m_handle == INVALID_HANDLE_VALUE) {
index 173bccbcda2fd795f63ad6a53ba27e5cbe66d06f..a48bacbbd0a50b0b3d79ea7313299f762a26d271 100644 (file)
@@ -38,11 +38,11 @@ public:
           const std::chrono::milliseconds& timeout) override;
 
   tl::expected<void, IpcError>
-  send(nonstd::span<const uint8_t> data,
+  send(std::span<const uint8_t> data,
        const std::chrono::milliseconds& timeout) override;
 
   tl::expected<size_t, IpcError>
-  receive(nonstd::span<uint8_t> buffer,
+  receive(std::span<uint8_t> buffer,
           const std::chrono::milliseconds& timeout) override;
 
   void close() override;
index 6780d119765f73fd05a9dccad3f0cd6b71db2cf5..557ea6520308398b5bcbeea2fddb6d0b4c58007f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -21,7 +21,6 @@
 #include <ccache/util/bytes.hpp>
 #include <ccache/util/conversion.hpp>
 
-#include <nonstd/span.hpp>
 #ifdef USE_XXH_DISPATCH
 #  include <xxh_x86dispatch.h>
 #else
@@ -30,6 +29,7 @@
 
 #include <cstdint>
 #include <cstring>
+#include <span>
 
 namespace util {
 
@@ -42,7 +42,7 @@ public:
   ~XXH3_128();
 
   void reset();
-  void update(nonstd::span<const uint8_t> data);
+  void update(std::span<const uint8_t> data);
   Bytes digest() const;
 
 private:
@@ -67,7 +67,7 @@ XXH3_128::reset()
 }
 
 inline void
-XXH3_128::update(nonstd::span<const uint8_t> data)
+XXH3_128::update(std::span<const uint8_t> data)
 {
   XXH3_128bits_update(m_state, data.data(), data.size());
 }
index 683c4642dd9481342d5531fc3f35f0a522d0f8c8..17fbc328be7f63cf9a8e4c86a986c13ba62be054 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -23,7 +23,7 @@
 namespace util {
 
 tl::expected<void, std::string>
-zstd_compress(nonstd::span<const uint8_t> input,
+zstd_compress(std::span<const uint8_t> input,
               Bytes& output,
               int8_t compression_level)
 {
@@ -45,7 +45,7 @@ zstd_compress(nonstd::span<const uint8_t> input,
 }
 
 tl::expected<void, std::string>
-zstd_decompress(nonstd::span<const uint8_t> input,
+zstd_decompress(std::span<const uint8_t> input,
                 Bytes& output,
                 size_t original_size)
 {
index f6f2b0d9a381207e6a9e6df68abe627565238526..bc7e53277d8d47991033a0f9c2566a501d3e4493 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
 
 #include <ccache/util/bytes.hpp>
 
-#include <nonstd/span.hpp>
 #include <tl/expected.hpp>
 
 #include <cstddef>
 #include <cstdint>
+#include <span>
 #include <string>
 #include <tuple>
 
 namespace util {
 
 [[nodiscard]] tl::expected<void, std::string> zstd_compress(
-  nonstd::span<const uint8_t> input, Bytes& output, int8_t compression_level);
+  std::span<const uint8_t> input, Bytes& output, int8_t compression_level);
 
 [[nodiscard]] tl::expected<void, std::string> zstd_decompress(
-  nonstd::span<const uint8_t> input, Bytes& output, size_t original_size);
+  std::span<const uint8_t> input, Bytes& output, size_t original_size);
 
 size_t zstd_compress_bound(size_t input_size);
 
index 51244e111605879aa7e812ef9f95598b2c74a3af..957ca7c1285a1f59132dbf13774886f842729c45 100644 (file)
@@ -12,9 +12,6 @@ endif()
 if(NOT TARGET dep_fmt)
   add_subdirectory(fmt)
 endif()
-if(NOT TARGET dep_nonstdspan)
-  add_subdirectory(nonstd-span)
-endif()
 if(NOT TARGET dep_tlexpected)
   add_subdirectory(tl-expected)
 endif()
diff --git a/src/third_party/nonstd-span/CMakeLists.txt b/src/third_party/nonstd-span/CMakeLists.txt
deleted file mode 100644 (file)
index a285bab..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-register_dependency(NonstdSpan BUNDLED 0.11.0)
-add_header_only_library(nonstdspan DIR "${CMAKE_CURRENT_SOURCE_DIR}")
diff --git a/src/third_party/nonstd-span/nonstd/span.hpp b/src/third_party/nonstd-span/nonstd/span.hpp
deleted file mode 100644 (file)
index 3d2d86a..0000000
+++ /dev/null
@@ -1,1947 +0,0 @@
-//
-// span for C++98 and later.
-// Based on http://wg21.link/p0122r7
-// For more information see https://github.com/martinmoene/span-lite
-//
-// Copyright 2018-2021 Martin Moene
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef NONSTD_SPAN_HPP_INCLUDED
-#define NONSTD_SPAN_HPP_INCLUDED
-
-#define span_lite_MAJOR  0
-#define span_lite_MINOR  11
-#define span_lite_PATCH  0
-
-#define span_lite_VERSION  span_STRINGIFY(span_lite_MAJOR) "." span_STRINGIFY(span_lite_MINOR) "." span_STRINGIFY(span_lite_PATCH)
-
-#define span_STRINGIFY(  x )  span_STRINGIFY_( x )
-#define span_STRINGIFY_( x )  #x
-
-// span configuration:
-
-#define span_SPAN_DEFAULT  0
-#define span_SPAN_NONSTD   1
-#define span_SPAN_STD      2
-
-// tweak header support:
-
-#ifdef __has_include
-# if __has_include(<nonstd/span.tweak.hpp>)
-#  include <nonstd/span.tweak.hpp>
-# endif
-#define span_HAVE_TWEAK_HEADER  1
-#else
-#define span_HAVE_TWEAK_HEADER  0
-//# pragma message("span.hpp: Note: Tweak header not supported.")
-#endif
-
-// span selection and configuration:
-
-#define span_HAVE( feature )  ( span_HAVE_##feature )
-
-#ifndef  span_CONFIG_SELECT_SPAN
-# define span_CONFIG_SELECT_SPAN  ( span_HAVE_STD_SPAN ? span_SPAN_STD : span_SPAN_NONSTD )
-#endif
-
-#ifndef  span_CONFIG_EXTENT_TYPE
-# define span_CONFIG_EXTENT_TYPE  std::size_t
-#endif
-
-#ifndef  span_CONFIG_SIZE_TYPE
-# define span_CONFIG_SIZE_TYPE  std::size_t
-#endif
-
-#ifdef span_CONFIG_INDEX_TYPE
-# error `span_CONFIG_INDEX_TYPE` is deprecated since v0.7.0; it is replaced by `span_CONFIG_SIZE_TYPE`.
-#endif
-
-// span configuration (features):
-
-#ifndef  span_FEATURE_WITH_INITIALIZER_LIST_P2447
-# define span_FEATURE_WITH_INITIALIZER_LIST_P2447  0
-#endif
-
-#ifndef  span_FEATURE_WITH_CONTAINER
-#ifdef   span_FEATURE_WITH_CONTAINER_TO_STD
-# define span_FEATURE_WITH_CONTAINER  span_IN_STD( span_FEATURE_WITH_CONTAINER_TO_STD )
-#else
-# define span_FEATURE_WITH_CONTAINER  0
-# define span_FEATURE_WITH_CONTAINER_TO_STD  0
-#endif
-#endif
-
-#ifndef  span_FEATURE_CONSTRUCTION_FROM_STDARRAY_ELEMENT_TYPE
-# define span_FEATURE_CONSTRUCTION_FROM_STDARRAY_ELEMENT_TYPE  0
-#endif
-
-#ifndef  span_FEATURE_MEMBER_AT
-# define span_FEATURE_MEMBER_AT  0
-#endif
-
-#ifndef  span_FEATURE_MEMBER_BACK_FRONT
-# define span_FEATURE_MEMBER_BACK_FRONT  1
-#endif
-
-#ifndef  span_FEATURE_MEMBER_CALL_OPERATOR
-# define span_FEATURE_MEMBER_CALL_OPERATOR  0
-#endif
-
-#ifndef  span_FEATURE_MEMBER_SWAP
-# define span_FEATURE_MEMBER_SWAP  0
-#endif
-
-#ifndef  span_FEATURE_NON_MEMBER_FIRST_LAST_SUB
-# define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB  0
-#elif    span_FEATURE_NON_MEMBER_FIRST_LAST_SUB
-# define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_SPAN       1
-# define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_CONTAINER  1
-#endif
-
-#ifndef  span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_SPAN
-# define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_SPAN  0
-#endif
-
-#ifndef  span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_CONTAINER
-# define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_CONTAINER  0
-#endif
-
-#ifndef  span_FEATURE_COMPARISON
-# define span_FEATURE_COMPARISON  0  // Note: C++20 does not provide comparison
-#endif
-
-#ifndef  span_FEATURE_SAME
-# define span_FEATURE_SAME  0
-#endif
-
-#if span_FEATURE_SAME && !span_FEATURE_COMPARISON
-# error `span_FEATURE_SAME` requires `span_FEATURE_COMPARISON`
-#endif
-
-#ifndef  span_FEATURE_MAKE_SPAN
-#ifdef   span_FEATURE_MAKE_SPAN_TO_STD
-# define span_FEATURE_MAKE_SPAN  span_IN_STD( span_FEATURE_MAKE_SPAN_TO_STD )
-#else
-# define span_FEATURE_MAKE_SPAN  0
-# define span_FEATURE_MAKE_SPAN_TO_STD  0
-#endif
-#endif
-
-#ifndef  span_FEATURE_BYTE_SPAN
-# define span_FEATURE_BYTE_SPAN  0
-#endif
-
-// Control presence of exception handling (try and auto discover):
-
-#ifndef span_CONFIG_NO_EXCEPTIONS
-# if defined(_MSC_VER)
-#  include <cstddef>    // for _HAS_EXCEPTIONS
-# endif
-# if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || (_HAS_EXCEPTIONS)
-#  define span_CONFIG_NO_EXCEPTIONS  0
-# else
-#  define span_CONFIG_NO_EXCEPTIONS  1
-#  undef  span_CONFIG_CONTRACT_VIOLATION_THROWS
-#  undef  span_CONFIG_CONTRACT_VIOLATION_TERMINATES
-#  define span_CONFIG_CONTRACT_VIOLATION_THROWS  0
-#  define span_CONFIG_CONTRACT_VIOLATION_TERMINATES  1
-# endif
-#endif
-
-// Control pre- and postcondition violation behaviour:
-
-#if    defined( span_CONFIG_CONTRACT_LEVEL_ON )
-# define        span_CONFIG_CONTRACT_LEVEL_MASK  0x11
-#elif  defined( span_CONFIG_CONTRACT_LEVEL_OFF )
-# define        span_CONFIG_CONTRACT_LEVEL_MASK  0x00
-#elif  defined( span_CONFIG_CONTRACT_LEVEL_EXPECTS_ONLY )
-# define        span_CONFIG_CONTRACT_LEVEL_MASK  0x01
-#elif  defined( span_CONFIG_CONTRACT_LEVEL_ENSURES_ONLY )
-# define        span_CONFIG_CONTRACT_LEVEL_MASK  0x10
-#else
-# define        span_CONFIG_CONTRACT_LEVEL_MASK  0x11
-#endif
-
-#if    defined( span_CONFIG_CONTRACT_VIOLATION_THROWS )
-# define        span_CONFIG_CONTRACT_VIOLATION_THROWS_V  span_CONFIG_CONTRACT_VIOLATION_THROWS
-#else
-# define        span_CONFIG_CONTRACT_VIOLATION_THROWS_V  0
-#endif
-
-#if    defined( span_CONFIG_CONTRACT_VIOLATION_THROWS     ) && span_CONFIG_CONTRACT_VIOLATION_THROWS && \
-       defined( span_CONFIG_CONTRACT_VIOLATION_TERMINATES ) && span_CONFIG_CONTRACT_VIOLATION_TERMINATES
-# error Please define none or one of span_CONFIG_CONTRACT_VIOLATION_THROWS and span_CONFIG_CONTRACT_VIOLATION_TERMINATES to 1, but not both.
-#endif
-
-// C++ language version detection (C++23 is speculative):
-// Note: VC14.0/1900 (VS2015) lacks too much from C++14.
-
-#ifndef   span_CPLUSPLUS
-# if defined(_MSVC_LANG ) && !defined(__clang__)
-#  define span_CPLUSPLUS  (_MSC_VER == 1900 ? 201103L : _MSVC_LANG )
-# else
-#  define span_CPLUSPLUS  __cplusplus
-# endif
-#endif
-
-#define span_CPP98_OR_GREATER  ( span_CPLUSPLUS >= 199711L )
-#define span_CPP11_OR_GREATER  ( span_CPLUSPLUS >= 201103L )
-#define span_CPP14_OR_GREATER  ( span_CPLUSPLUS >= 201402L )
-#define span_CPP17_OR_GREATER  ( span_CPLUSPLUS >= 201703L )
-#define span_CPP20_OR_GREATER  ( span_CPLUSPLUS >= 202002L )
-#define span_CPP23_OR_GREATER  ( span_CPLUSPLUS >= 202300L )
-
-// C++ language version (represent 98 as 3):
-
-#define span_CPLUSPLUS_V  ( span_CPLUSPLUS / 100 - (span_CPLUSPLUS > 200000 ? 2000 : 1994) )
-
-#define span_IN_STD( v )  ( ((v) == 98 ? 3 : (v)) >= span_CPLUSPLUS_V )
-
-#define span_CONFIG(         feature )  ( span_CONFIG_##feature )
-#define span_FEATURE(        feature )  ( span_FEATURE_##feature )
-#define span_FEATURE_TO_STD( feature )  ( span_IN_STD( span_FEATURE( feature##_TO_STD ) ) )
-
-// Use C++20 std::span if available and requested:
-
-#if span_CPP20_OR_GREATER && defined(__has_include )
-# if __has_include( <span> )
-#  define span_HAVE_STD_SPAN  1
-# else
-#  define span_HAVE_STD_SPAN  0
-# endif
-#else
-# define  span_HAVE_STD_SPAN  0
-#endif
-
-#define  span_USES_STD_SPAN  ( (span_CONFIG_SELECT_SPAN == span_SPAN_STD) || ((span_CONFIG_SELECT_SPAN == span_SPAN_DEFAULT) && span_HAVE_STD_SPAN) )
-
-//
-// Use C++20 std::span:
-//
-
-#if span_USES_STD_SPAN
-
-#include <span>
-
-namespace nonstd {
-
-using std::span;
-using std::dynamic_extent;
-
-// Note: C++20 does not provide comparison
-// using std::operator==;
-// using std::operator!=;
-// using std::operator<;
-// using std::operator<=;
-// using std::operator>;
-// using std::operator>=;
-}  // namespace nonstd
-
-#else  // span_USES_STD_SPAN
-
-#include <algorithm>
-
-// Compiler versions:
-//
-// MSVC++  6.0  _MSC_VER == 1200  span_COMPILER_MSVC_VERSION ==  60  (Visual Studio 6.0)
-// MSVC++  7.0  _MSC_VER == 1300  span_COMPILER_MSVC_VERSION ==  70  (Visual Studio .NET 2002)
-// MSVC++  7.1  _MSC_VER == 1310  span_COMPILER_MSVC_VERSION ==  71  (Visual Studio .NET 2003)
-// MSVC++  8.0  _MSC_VER == 1400  span_COMPILER_MSVC_VERSION ==  80  (Visual Studio 2005)
-// MSVC++  9.0  _MSC_VER == 1500  span_COMPILER_MSVC_VERSION ==  90  (Visual Studio 2008)
-// MSVC++ 10.0  _MSC_VER == 1600  span_COMPILER_MSVC_VERSION == 100  (Visual Studio 2010)
-// MSVC++ 11.0  _MSC_VER == 1700  span_COMPILER_MSVC_VERSION == 110  (Visual Studio 2012)
-// MSVC++ 12.0  _MSC_VER == 1800  span_COMPILER_MSVC_VERSION == 120  (Visual Studio 2013)
-// MSVC++ 14.0  _MSC_VER == 1900  span_COMPILER_MSVC_VERSION == 140  (Visual Studio 2015)
-// MSVC++ 14.1  _MSC_VER >= 1910  span_COMPILER_MSVC_VERSION == 141  (Visual Studio 2017)
-// MSVC++ 14.2  _MSC_VER >= 1920  span_COMPILER_MSVC_VERSION == 142  (Visual Studio 2019)
-
-#if defined(_MSC_VER ) && !defined(__clang__)
-# define span_COMPILER_MSVC_VER      (_MSC_VER )
-# define span_COMPILER_MSVC_VERSION  (_MSC_VER / 10 - 10 * ( 5 + (_MSC_VER < 1900 ) ) )
-#else
-# define span_COMPILER_MSVC_VER      0
-# define span_COMPILER_MSVC_VERSION  0
-#endif
-
-#define span_COMPILER_VERSION( major, minor, patch )  ( 10 * ( 10 * (major) + (minor) ) + (patch) )
-
-#if defined(__clang__)
-# define span_COMPILER_CLANG_VERSION  span_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
-#else
-# define span_COMPILER_CLANG_VERSION  0
-#endif
-
-#if defined(__GNUC__) && !defined(__clang__)
-# define span_COMPILER_GNUC_VERSION  span_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
-#else
-# define span_COMPILER_GNUC_VERSION  0
-#endif
-
-// half-open range [lo..hi):
-#define span_BETWEEN( v, lo, hi )  ( (lo) <= (v) && (v) < (hi) )
-
-// Compiler warning suppression:
-
-#if defined(__clang__)
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wundef"
-# pragma clang diagnostic ignored "-Wmismatched-tags"
-# define span_RESTORE_WARNINGS()   _Pragma( "clang diagnostic pop" )
-
-#elif defined __GNUC__
-# pragma GCC   diagnostic push
-# pragma GCC   diagnostic ignored "-Wundef"
-# define span_RESTORE_WARNINGS()   _Pragma( "GCC diagnostic pop" )
-
-#elif span_COMPILER_MSVC_VER >= 1900
-# define span_DISABLE_MSVC_WARNINGS(codes)  __pragma(warning(push))  __pragma(warning(disable: codes))
-# define span_RESTORE_WARNINGS()            __pragma(warning(pop ))
-
-// Suppress the following MSVC GSL warnings:
-// - C26439, gsl::f.6 : special function 'function' can be declared 'noexcept'
-// - C26440, gsl::f.6 : function 'function' can be declared 'noexcept'
-// - C26472, gsl::t.1 : don't use a static_cast for arithmetic conversions;
-//                      use brace initialization, gsl::narrow_cast or gsl::narrow
-// - C26473: gsl::t.1 : don't cast between pointer types where the source type and the target type are the same
-// - C26481: gsl::b.1 : don't use pointer arithmetic. Use span instead
-// - C26490: gsl::t.1 : don't use reinterpret_cast
-
-span_DISABLE_MSVC_WARNINGS( 26439 26440 26472 26473 26481 26490 )
-
-#else
-# define span_RESTORE_WARNINGS()  /*empty*/
-#endif
-
-// Presence of language and library features:
-
-#ifdef _HAS_CPP0X
-# define span_HAS_CPP0X  _HAS_CPP0X
-#else
-# define span_HAS_CPP0X  0
-#endif
-
-#define span_CPP11_80   (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1400)
-#define span_CPP11_90   (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1500)
-#define span_CPP11_100  (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1600)
-#define span_CPP11_110  (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1700)
-#define span_CPP11_120  (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1800)
-#define span_CPP11_140  (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1900)
-
-#define span_CPP14_000  (span_CPP14_OR_GREATER)
-#define span_CPP14_120  (span_CPP14_OR_GREATER || span_COMPILER_MSVC_VER >= 1800)
-#define span_CPP14_140  (span_CPP14_OR_GREATER || span_COMPILER_MSVC_VER >= 1900)
-
-#define span_CPP17_000  (span_CPP17_OR_GREATER)
-
-// Presence of C++11 language features:
-
-#define span_HAVE_ALIAS_TEMPLATE            span_CPP11_140
-#define span_HAVE_AUTO                      span_CPP11_100
-#define span_HAVE_CONSTEXPR_11              span_CPP11_140
-#define span_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG  span_CPP11_120
-#define span_HAVE_EXPLICIT_CONVERSION       span_CPP11_140
-#define span_HAVE_INITIALIZER_LIST          span_CPP11_120
-#define span_HAVE_IS_DEFAULT                span_CPP11_140
-#define span_HAVE_IS_DELETE                 span_CPP11_140
-#define span_HAVE_NOEXCEPT                  span_CPP11_140
-#define span_HAVE_NORETURN                ( span_CPP11_140 && ! span_BETWEEN( span_COMPILER_GNUC_VERSION, 1, 480 ) )
-#define span_HAVE_NULLPTR                   span_CPP11_100
-#define span_HAVE_STATIC_ASSERT             span_CPP11_100
-
-// Presence of C++14 language features:
-
-#define span_HAVE_CONSTEXPR_14              span_CPP14_000
-
-// Presence of C++17 language features:
-
-#define span_HAVE_DEPRECATED                span_CPP17_000
-#define span_HAVE_NODISCARD                 span_CPP17_000
-
-// MSVC: template parameter deduction guides since Visual Studio 2017 v15.7
-
-#if defined(__cpp_deduction_guides)
-# define span_HAVE_DEDUCTION_GUIDES         1
-#else
-# define span_HAVE_DEDUCTION_GUIDES         (span_CPP17_OR_GREATER && ! span_BETWEEN( span_COMPILER_MSVC_VER, 1, 1913 ))
-#endif
-
-// Presence of C++ library features:
-
-#define span_HAVE_ADDRESSOF                 span_CPP17_000
-#define span_HAVE_ARRAY                     span_CPP11_110
-#define span_HAVE_BYTE                      span_CPP17_000
-#define span_HAVE_CONDITIONAL               span_CPP11_120
-#define span_HAVE_CONTAINER_DATA_METHOD    (span_CPP11_140 || ( span_COMPILER_MSVC_VER >= 1500 && span_HAS_CPP0X ))
-#define span_HAVE_DATA                      span_CPP17_000
-#define span_HAVE_LONGLONG                  span_CPP11_80
-#define span_HAVE_REMOVE_CONST              span_CPP11_110
-#define span_HAVE_SNPRINTF                  span_CPP11_140
-#define span_HAVE_STRUCT_BINDING            span_CPP11_120
-#define span_HAVE_TYPE_TRAITS               span_CPP11_90
-
-// Presence of byte-lite:
-
-#ifdef NONSTD_BYTE_LITE_HPP
-# define span_HAVE_NONSTD_BYTE  1
-#else
-# define span_HAVE_NONSTD_BYTE  0
-#endif
-
-// C++ feature usage:
-
-#if span_HAVE_ADDRESSOF
-# define span_ADDRESSOF(x)  std::addressof(x)
-#else
-# define span_ADDRESSOF(x)  (&x)
-#endif
-
-#if span_HAVE_CONSTEXPR_11
-# define span_constexpr constexpr
-#else
-# define span_constexpr /*span_constexpr*/
-#endif
-
-#if span_HAVE_CONSTEXPR_14
-# define span_constexpr14 constexpr
-#else
-# define span_constexpr14 /*span_constexpr*/
-#endif
-
-#if span_HAVE_EXPLICIT_CONVERSION
-# define span_explicit explicit
-#else
-# define span_explicit /*explicit*/
-#endif
-
-#if span_HAVE_IS_DELETE
-# define span_is_delete = delete
-#else
-# define span_is_delete
-#endif
-
-#if span_HAVE_IS_DELETE
-# define span_is_delete_access public
-#else
-# define span_is_delete_access private
-#endif
-
-#if span_HAVE_NOEXCEPT && ! span_CONFIG_CONTRACT_VIOLATION_THROWS_V
-# define span_noexcept noexcept
-#else
-# define span_noexcept /*noexcept*/
-#endif
-
-#if span_HAVE_NULLPTR
-# define span_nullptr nullptr
-#else
-# define span_nullptr NULL
-#endif
-
-#if span_HAVE_DEPRECATED
-# define span_deprecated(msg) [[deprecated(msg)]]
-#else
-# define span_deprecated(msg) /*[[deprecated]]*/
-#endif
-
-#if span_HAVE_NODISCARD
-# define span_nodiscard [[nodiscard]]
-#else
-# define span_nodiscard /*[[nodiscard]]*/
-#endif
-
-#if span_HAVE_NORETURN
-# define span_noreturn [[noreturn]]
-#else
-# define span_noreturn /*[[noreturn]]*/
-#endif
-
-// Other features:
-
-#define span_HAVE_CONSTRAINED_SPAN_CONTAINER_CTOR  span_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG
-#define span_HAVE_ITERATOR_CTOR                    span_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG
-
-// Additional includes:
-
-#if span_HAVE( ADDRESSOF )
-# include <memory>
-#endif
-
-#if span_HAVE( ARRAY )
-# include <array>
-#endif
-
-#if span_HAVE( BYTE )
-# include <cstddef>
-#endif
-
-#if span_HAVE( DATA )
-# include <iterator> // for std::data(), std::size()
-#endif
-
-#if span_HAVE( TYPE_TRAITS )
-# include <type_traits>
-#endif
-
-#if ! span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
-# include <vector>
-#endif
-
-#if span_FEATURE( MEMBER_AT ) > 1
-# include <cstdio>
-#endif
-
-#if ! span_CONFIG( NO_EXCEPTIONS )
-# include <stdexcept>
-#endif
-
-// Contract violation
-
-#define span_ELIDE_CONTRACT_EXPECTS  ( 0 == ( span_CONFIG_CONTRACT_LEVEL_MASK & 0x01 ) )
-#define span_ELIDE_CONTRACT_ENSURES  ( 0 == ( span_CONFIG_CONTRACT_LEVEL_MASK & 0x10 ) )
-
-#if span_ELIDE_CONTRACT_EXPECTS
-# define span_constexpr_exp    span_constexpr
-# define span_EXPECTS( cond )  /* Expect elided */
-#else
-# define span_constexpr_exp    span_constexpr14
-# define span_EXPECTS( cond )  span_CONTRACT_CHECK( "Precondition", cond )
-#endif
-
-#if span_ELIDE_CONTRACT_ENSURES
-# define span_constexpr_ens    span_constexpr
-# define span_ENSURES( cond )  /* Ensures elided */
-#else
-# define span_constexpr_ens    span_constexpr14
-# define span_ENSURES( cond )  span_CONTRACT_CHECK( "Postcondition", cond )
-#endif
-
-#define span_CONTRACT_CHECK( type, cond ) \
-    cond ? static_cast< void >( 0 ) \
-         : nonstd::span_lite::detail::report_contract_violation( span_LOCATION( __FILE__, __LINE__ ) ": " type " violation." )
-
-#ifdef __GNUG__
-# define span_LOCATION( file, line )  file ":" span_STRINGIFY( line )
-#else
-# define span_LOCATION( file, line )  file "(" span_STRINGIFY( line ) ")"
-#endif
-
-// Method enabling
-
-#if span_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG )
-
-#define span_REQUIRES_0(VA) \
-    template< bool B = (VA), typename std::enable_if<B, int>::type = 0 >
-
-# if span_BETWEEN( span_COMPILER_MSVC_VERSION, 1, 140 )
-// VS 2013 and earlier seem to have trouble with SFINAE for default non-type arguments
-# define span_REQUIRES_T(VA) \
-    , typename = typename std::enable_if< ( VA ), nonstd::span_lite::detail::enabler >::type
-# else
-# define span_REQUIRES_T(VA) \
-    , typename std::enable_if< (VA), int >::type = 0
-# endif
-
-#define span_REQUIRES_R(R, VA) \
-    typename std::enable_if< (VA), R>::type
-
-#define span_REQUIRES_A(VA) \
-    , typename std::enable_if< (VA), void*>::type = nullptr
-
-#else
-
-# define span_REQUIRES_0(VA)    /*empty*/
-# define span_REQUIRES_T(VA)    /*empty*/
-# define span_REQUIRES_R(R, VA) R
-# define span_REQUIRES_A(VA)    /*empty*/
-
-#endif
-
-namespace nonstd {
-namespace span_lite {
-
-// [views.constants], constants
-
-typedef span_CONFIG_EXTENT_TYPE extent_t;
-typedef span_CONFIG_SIZE_TYPE   size_t;
-
-span_constexpr const extent_t dynamic_extent = static_cast<extent_t>( -1 );
-
-template< class T, extent_t Extent = dynamic_extent >
-class span;
-
-// Tag to select span constructor taking a container (prevent ms-gsl warning C26426):
-
-struct with_container_t { span_constexpr with_container_t() span_noexcept {} };
-const  span_constexpr   with_container_t with_container;
-
-// C++11 emulation:
-
-namespace std11 {
-
-#if span_HAVE( REMOVE_CONST )
-
-using std::remove_cv;
-using std::remove_const;
-using std::remove_volatile;
-
-#else
-
-template< class T > struct remove_const            { typedef T type; };
-template< class T > struct remove_const< T const > { typedef T type; };
-
-template< class T > struct remove_volatile               { typedef T type; };
-template< class T > struct remove_volatile< T volatile > { typedef T type; };
-
-template< class T >
-struct remove_cv
-{
-    typedef typename std11::remove_volatile< typename std11::remove_const< T >::type >::type type;
-};
-
-#endif  // span_HAVE( REMOVE_CONST )
-
-#if span_HAVE( TYPE_TRAITS )
-
-using std::is_same;
-using std::is_signed;
-using std::integral_constant;
-using std::true_type;
-using std::false_type;
-using std::remove_reference;
-
-#else
-
-template< class T, T v > struct integral_constant { enum { value = v }; };
-typedef integral_constant< bool, true  > true_type;
-typedef integral_constant< bool, false > false_type;
-
-template< class T, class U > struct is_same : false_type{};
-template< class T          > struct is_same<T, T> : true_type{};
-
-template< typename T >  struct is_signed : false_type {};
-template<> struct is_signed<signed char> : true_type {};
-template<> struct is_signed<signed int > : true_type {};
-template<> struct is_signed<signed long> : true_type {};
-
-#endif
-
-} // namespace std11
-
-// C++17 emulation:
-
-namespace std17 {
-
-template< bool v > struct bool_constant : std11::integral_constant<bool, v>{};
-
-#if span_CPP11_120
-
-template< class...>
-using void_t = void;
-
-#endif
-
-#if span_HAVE( DATA )
-
-using std::data;
-using std::size;
-
-#elif span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
-
-template< typename T, std::size_t N >
-inline span_constexpr auto size( const T(&)[N] ) span_noexcept -> size_t
-{
-    return N;
-}
-
-template< typename C >
-inline span_constexpr auto size( C const & cont ) -> decltype( cont.size() )
-{
-    return cont.size();
-}
-
-template< typename T, std::size_t N >
-inline span_constexpr auto data( T(&arr)[N] ) span_noexcept -> T*
-{
-    return &arr[0];
-}
-
-template< typename C >
-inline span_constexpr auto data( C & cont ) -> decltype( cont.data() )
-{
-    return cont.data();
-}
-
-template< typename C >
-inline span_constexpr auto data( C const & cont ) -> decltype( cont.data() )
-{
-    return cont.data();
-}
-
-template< typename E >
-inline span_constexpr auto data( std::initializer_list<E> il ) span_noexcept -> E const *
-{
-    return il.begin();
-}
-
-#endif // span_HAVE( DATA )
-
-#if span_HAVE( BYTE )
-using std::byte;
-#elif span_HAVE( NONSTD_BYTE )
-using nonstd::byte;
-#endif
-
-} // namespace std17
-
-// C++20 emulation:
-
-namespace std20 {
-
-#if span_HAVE( DEDUCTION_GUIDES )
-template< class T >
-using iter_reference_t = decltype( *std::declval<T&>() );
-#endif
-
-} // namespace std20
-
-// Implementation details:
-
-namespace detail {
-
-/*enum*/ struct enabler{};
-
-template< typename T >
-span_constexpr bool is_positive( T x )
-{
-    return std11::is_signed<T>::value ? x >= 0 : true;
-}
-
-#if span_HAVE( TYPE_TRAITS )
-
-template< class Q >
-struct is_span_oracle : std::false_type{};
-
-template< class T, span_CONFIG_EXTENT_TYPE Extent >
-struct is_span_oracle< span<T, Extent> > : std::true_type{};
-
-template< class Q >
-struct is_span : is_span_oracle< typename std::remove_cv<Q>::type >{};
-
-template< class Q >
-struct is_std_array_oracle : std::false_type{};
-
-#if span_HAVE( ARRAY )
-
-template< class T, std::size_t Extent >
-struct is_std_array_oracle< std::array<T, Extent> > : std::true_type{};
-
-#endif
-
-template< class Q >
-struct is_std_array : is_std_array_oracle< typename std::remove_cv<Q>::type >{};
-
-template< class Q >
-struct is_array : std::false_type {};
-
-template< class T >
-struct is_array<T[]> : std::true_type {};
-
-template< class T, std::size_t N >
-struct is_array<T[N]> : std::true_type {};
-
-#if span_CPP11_140 && ! span_BETWEEN( span_COMPILER_GNUC_VERSION, 1, 500 )
-
-template< class, class = void >
-struct has_size_and_data : std::false_type{};
-
-template< class C >
-struct has_size_and_data
-<
-    C, std17::void_t<
-        decltype( std17::size(std::declval<C>()) ),
-        decltype( std17::data(std::declval<C>()) ) >
-> : std::true_type{};
-
-template< class, class, class = void >
-struct is_compatible_element : std::false_type {};
-
-template< class C, class E >
-struct is_compatible_element
-<
-    C, E, std17::void_t<
-        decltype( std17::data(std::declval<C>()) ) >
-> : std::is_convertible< typename std::remove_pointer<decltype( std17::data( std::declval<C&>() ) )>::type(*)[], E(*)[] >{};
-
-template< class C >
-struct is_container : std17::bool_constant
-<
-    ! is_span< C >::value
-    && ! is_array< C >::value
-    && ! is_std_array< C >::value
-    &&   has_size_and_data< C >::value
->{};
-
-template< class C, class E >
-struct is_compatible_container : std17::bool_constant
-<
-    is_container<C>::value
-    && is_compatible_element<C,E>::value
->{};
-
-#else // span_CPP11_140
-
-template<
-    class C, class E
-        span_REQUIRES_T((
-            ! is_span< C >::value
-            && ! is_array< C >::value
-            && ! is_std_array< C >::value
-            && ( std::is_convertible< typename std::remove_pointer<decltype( std17::data( std::declval<C&>() ) )>::type(*)[], E(*)[] >::value)
-        //  &&   has_size_and_data< C >::value
-        ))
-        , class = decltype( std17::size(std::declval<C>()) )
-        , class = decltype( std17::data(std::declval<C>()) )
->
-struct is_compatible_container : std::true_type{};
-
-#endif // span_CPP11_140
-
-#endif // span_HAVE( TYPE_TRAITS )
-
-#if ! span_CONFIG( NO_EXCEPTIONS )
-#if   span_FEATURE( MEMBER_AT ) > 1
-
-// format index and size:
-
-#if defined(__clang__)
-# pragma clang diagnostic ignored "-Wlong-long"
-#elif defined __GNUC__
-# pragma GCC   diagnostic ignored "-Wformat=ll"
-# pragma GCC   diagnostic ignored "-Wlong-long"
-#endif
-
-span_noreturn inline void throw_out_of_range( size_t idx, size_t size )
-{
-    const char fmt[] = "span::at(): index '%lli' is out of range [0..%lli)";
-    char buffer[ 2 * 20 + sizeof fmt ];
-    sprintf( buffer, fmt, static_cast<long long>(idx), static_cast<long long>(size) );
-
-    throw std::out_of_range( buffer );
-}
-
-#else // MEMBER_AT
-
-span_noreturn inline void throw_out_of_range( size_t /*idx*/, size_t /*size*/ )
-{
-    throw std::out_of_range( "span::at(): index outside span" );
-}
-#endif  // MEMBER_AT
-#endif  // NO_EXCEPTIONS
-
-#if span_CONFIG( CONTRACT_VIOLATION_THROWS_V )
-
-struct contract_violation : std::logic_error
-{
-    explicit contract_violation( char const * const message )
-        : std::logic_error( message )
-    {}
-};
-
-inline void report_contract_violation( char const * msg )
-{
-    throw contract_violation( msg );
-}
-
-#else // span_CONFIG( CONTRACT_VIOLATION_THROWS_V )
-
-span_noreturn inline void report_contract_violation( char const * /*msg*/ ) span_noexcept
-{
-    std::terminate();
-}
-
-#endif // span_CONFIG( CONTRACT_VIOLATION_THROWS_V )
-
-}  // namespace detail
-
-// Prevent signed-unsigned mismatch:
-
-#define span_sizeof(T)  static_cast<extent_t>( sizeof(T) )
-
-template< class T >
-inline span_constexpr size_t to_size( T size )
-{
-    return static_cast<size_t>( size );
-}
-
-//
-// [views.span] - A view over a contiguous, single-dimension sequence of objects
-//
-template< class T, extent_t Extent /*= dynamic_extent*/ >
-class span
-{
-public:
-    // constants and types
-
-    typedef T element_type;
-    typedef typename std11::remove_cv< T >::type value_type;
-
-    typedef T &       reference;
-    typedef T *       pointer;
-    typedef T const * const_pointer;
-    typedef T const & const_reference;
-
-    typedef size_t    size_type;
-    typedef extent_t  extent_type;
-
-    typedef pointer        iterator;
-    typedef const_pointer  const_iterator;
-
-    typedef std::ptrdiff_t difference_type;
-
-    typedef std::reverse_iterator< iterator >       reverse_iterator;
-    typedef std::reverse_iterator< const_iterator > const_reverse_iterator;
-
-//    static constexpr extent_type extent = Extent;
-    enum { extent = Extent };
-
-    // 26.7.3.2 Constructors, copy, and assignment [span.cons]
-
-    span_REQUIRES_0(
-        ( Extent == 0 ) ||
-        ( Extent == dynamic_extent )
-    )
-    span_constexpr span() span_noexcept
-        : data_( span_nullptr )
-        , size_( 0 )
-    {
-        // span_EXPECTS( data() == span_nullptr );
-        // span_EXPECTS( size() == 0 );
-    }
-
-#if span_HAVE( ITERATOR_CTOR )
-    // Didn't yet succeed in combining the next two constructors:
-
-    span_constexpr_exp span( std::nullptr_t, size_type count )
-        : data_( span_nullptr )
-        , size_( count )
-    {
-        span_EXPECTS( data_ == span_nullptr && count == 0 );
-    }
-
-    template< typename It
-        span_REQUIRES_T((
-            std::is_convertible<decltype(*std::declval<It&>()), element_type &>::value
-        ))
-    >
-    span_constexpr_exp span( It first, size_type count )
-        : data_( to_address( first ) )
-        , size_( count )
-    {
-        span_EXPECTS(
-            ( data_ == span_nullptr && count == 0 ) ||
-            ( data_ != span_nullptr && detail::is_positive( count ) )
-        );
-    }
-#else
-    span_constexpr_exp span( pointer ptr, size_type count )
-        : data_( ptr )
-        , size_( count )
-    {
-        span_EXPECTS(
-            ( ptr == span_nullptr && count == 0 ) ||
-            ( ptr != span_nullptr && detail::is_positive( count ) )
-        );
-    }
-#endif
-
-#if span_HAVE( ITERATOR_CTOR )
-    template< typename It, typename End
-        span_REQUIRES_T((
-            std::is_convertible<decltype(&*std::declval<It&>()), element_type *>::value
-            && ! std::is_convertible<End, std::size_t>::value
-        ))
-     >
-    span_constexpr_exp span( It first, End last )
-        : data_( to_address( first ) )
-        , size_( to_size( last - first ) )
-    {
-        span_EXPECTS(
-             last - first >= 0
-        );
-    }
-#else
-    span_constexpr_exp span( pointer first, pointer last )
-        : data_( first )
-        , size_( to_size( last - first ) )
-    {
-        span_EXPECTS(
-            last - first >= 0
-        );
-    }
-#endif
-
-    template< std::size_t N
-        span_REQUIRES_T((
-            (Extent == dynamic_extent || Extent == static_cast<extent_t>(N))
-            && std::is_convertible< value_type(*)[], element_type(*)[] >::value
-        ))
-    >
-    span_constexpr span( element_type ( &arr )[ N ] ) span_noexcept
-        : data_( span_ADDRESSOF( arr[0] ) )
-        , size_( N  )
-    {}
-
-#if span_HAVE( ARRAY )
-
-    template< std::size_t N
-        span_REQUIRES_T((
-            (Extent == dynamic_extent || Extent == static_cast<extent_t>(N))
-            && std::is_convertible< value_type(*)[], element_type(*)[] >::value
-        ))
-    >
-# if span_FEATURE( CONSTRUCTION_FROM_STDARRAY_ELEMENT_TYPE )
-        span_constexpr span( std::array< element_type, N > & arr ) span_noexcept
-# else
-        span_constexpr span( std::array< value_type, N > & arr ) span_noexcept
-# endif
-        : data_( arr.data() )
-        , size_( to_size( arr.size() ) )
-    {}
-
-    template< std::size_t N
-# if span_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG )
-        span_REQUIRES_T((
-            (Extent == dynamic_extent || Extent == static_cast<extent_t>(N))
-            && std::is_convertible< value_type(*)[], element_type(*)[] >::value
-        ))
-# endif
-    >
-    span_constexpr span( std::array< value_type, N> const & arr ) span_noexcept
-        : data_( arr.data() )
-        , size_( to_size( arr.size() ) )
-    {}
-
-#endif // span_HAVE( ARRAY )
-
-#if span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
-    template< class Container
-        span_REQUIRES_T((
-            detail::is_compatible_container< Container, element_type >::value
-        ))
-    >
-    span_constexpr span( Container & cont )
-        : data_( std17::data( cont ) )
-        , size_( to_size( std17::size( cont ) ) )
-    {}
-
-    template< class Container
-        span_REQUIRES_T((
-            std::is_const< element_type >::value
-            && detail::is_compatible_container< Container, element_type >::value
-        ))
-    >
-    span_constexpr span( Container const & cont )
-        : data_( std17::data( cont ) )
-        , size_( to_size( std17::size( cont ) ) )
-    {}
-
-#endif // span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
-
-#if span_FEATURE( WITH_CONTAINER )
-
-    template< class Container >
-    span_constexpr span( with_container_t, Container & cont )
-        : data_( cont.size() == 0 ? span_nullptr : span_ADDRESSOF( cont[0] ) )
-        , size_( to_size( cont.size() ) )
-    {}
-
-    template< class Container >
-    span_constexpr span( with_container_t, Container const & cont )
-        : data_( cont.size() == 0 ? span_nullptr : const_cast<pointer>( span_ADDRESSOF( cont[0] ) ) )
-        , size_( to_size( cont.size() ) )
-    {}
-#endif
-
-#if span_FEATURE( WITH_INITIALIZER_LIST_P2447 ) && span_HAVE( INITIALIZER_LIST )
-
-    // constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il) noexcept;
-
-#if !span_BETWEEN( span_COMPILER_MSVC_VERSION, 120, 130 )
-
-    template< extent_t U = Extent
-        span_REQUIRES_T((
-            U != dynamic_extent
-        ))
-    >
-#if span_COMPILER_GNUC_VERSION >= 900   // prevent GCC's "-Winit-list-lifetime"
-    span_constexpr14 explicit span( std::initializer_list<value_type> il ) span_noexcept
-    {
-        data_ = il.begin();
-        size_ = il.size();
-    }
-#else
-    span_constexpr explicit span( std::initializer_list<value_type> il ) span_noexcept
-        : data_( il.begin() )
-        , size_( il.size()  )
-    {}
-#endif
-
-#endif // MSVC 120 (VS2013)
-
-    template< extent_t U = Extent
-        span_REQUIRES_T((
-            U == dynamic_extent
-        ))
-    >
-#if span_COMPILER_GNUC_VERSION >= 900   // prevent GCC's "-Winit-list-lifetime"
-    span_constexpr14 /*explicit*/ span( std::initializer_list<value_type> il ) span_noexcept
-    {
-        data_ = il.begin();
-        size_ = il.size();
-    }
-#else
-    span_constexpr /*explicit*/ span( std::initializer_list<value_type> il ) span_noexcept
-        : data_( il.begin() )
-        , size_( il.size()  )
-    {}
-#endif
-
-#endif // P2447
-
-#if span_HAVE( IS_DEFAULT )
-    span_constexpr span( span const & other ) span_noexcept = default;
-
-    ~span() span_noexcept = default;
-
-    span_constexpr14 span & operator=( span const & other ) span_noexcept = default;
-#else
-    span_constexpr span( span const & other ) span_noexcept
-        : data_( other.data_ )
-        , size_( other.size_ )
-    {}
-
-    ~span() span_noexcept
-    {}
-
-    span_constexpr14 span & operator=( span const & other ) span_noexcept
-    {
-        data_ = other.data_;
-        size_ = other.size_;
-
-        return *this;
-    }
-#endif
-
-    template< class OtherElementType, extent_type OtherExtent
-        span_REQUIRES_T((
-            (Extent == dynamic_extent || OtherExtent == dynamic_extent || Extent == OtherExtent)
-            && std::is_convertible<OtherElementType(*)[], element_type(*)[]>::value
-        ))
-    >
-    span_constexpr_exp span( span<OtherElementType, OtherExtent> const & other ) span_noexcept
-        : data_( other.data() )
-        , size_( other.size() )
-    {
-        span_EXPECTS( OtherExtent == dynamic_extent || other.size() == to_size(OtherExtent) );
-    }
-
-    // 26.7.3.3 Subviews [span.sub]
-
-    template< extent_type Count >
-    span_constexpr_exp span< element_type, Count >
-    first() const
-    {
-        span_EXPECTS( detail::is_positive( Count ) && Count <= size() );
-
-        return span< element_type, Count >( data(), Count );
-    }
-
-    template< extent_type Count >
-    span_constexpr_exp span< element_type, Count >
-    last() const
-    {
-        span_EXPECTS( detail::is_positive( Count ) && Count <= size() );
-
-        return span< element_type, Count >( data() + (size() - Count), Count );
-    }
-
-#if span_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG )
-    template< size_type Offset, extent_type Count = dynamic_extent >
-#else
-    template< size_type Offset, extent_type Count /*= dynamic_extent*/ >
-#endif
-    span_constexpr_exp span< element_type, Count >
-    subspan() const
-    {
-        span_EXPECTS(
-            ( detail::is_positive( Offset ) && Offset <= size() ) &&
-            ( Count == dynamic_extent || (detail::is_positive( Count ) && Count + Offset <= size()) )
-        );
-
-        return span< element_type, Count >(
-            data() + Offset, Count != dynamic_extent ? Count : (Extent != dynamic_extent ? Extent - Offset : size() - Offset) );
-    }
-
-    span_constexpr_exp span< element_type, dynamic_extent >
-    first( size_type count ) const
-    {
-        span_EXPECTS( detail::is_positive( count ) && count <= size() );
-
-        return span< element_type, dynamic_extent >( data(), count );
-    }
-
-    span_constexpr_exp span< element_type, dynamic_extent >
-    last( size_type count ) const
-    {
-        span_EXPECTS( detail::is_positive( count ) && count <= size() );
-
-        return span< element_type, dynamic_extent >( data() + ( size() - count ), count );
-    }
-
-    span_constexpr_exp span< element_type, dynamic_extent >
-    subspan( size_type offset, size_type count = static_cast<size_type>(dynamic_extent) ) const
-    {
-        span_EXPECTS(
-            ( ( detail::is_positive( offset ) && offset <= size() ) ) &&
-            ( count == static_cast<size_type>(dynamic_extent) || ( detail::is_positive( count ) && offset + count <= size() ) )
-        );
-
-        return span< element_type, dynamic_extent >(
-            data() + offset, count == static_cast<size_type>(dynamic_extent) ? size() - offset : count );
-    }
-
-    // 26.7.3.4 Observers [span.obs]
-
-    span_constexpr size_type size() const span_noexcept
-    {
-        return size_;
-    }
-
-    span_constexpr std::ptrdiff_t ssize() const span_noexcept
-    {
-        return static_cast<std::ptrdiff_t>( size_ );
-    }
-
-    span_constexpr size_type size_bytes() const span_noexcept
-    {
-        return size() * to_size( sizeof( element_type ) );
-    }
-
-    span_nodiscard span_constexpr bool empty() const span_noexcept
-    {
-        return size() == 0;
-    }
-
-    // 26.7.3.5 Element access [span.elem]
-
-    span_constexpr_exp reference operator[]( size_type idx ) const
-    {
-        span_EXPECTS( detail::is_positive( idx ) && idx < size() );
-
-        return *( data() + idx );
-    }
-
-#if span_FEATURE( MEMBER_CALL_OPERATOR )
-    span_deprecated("replace operator() with operator[]")
-
-    span_constexpr_exp reference operator()( size_type idx ) const
-    {
-        span_EXPECTS( detail::is_positive( idx ) && idx < size() );
-
-        return *( data() + idx );
-    }
-#endif
-
-#if span_FEATURE( MEMBER_AT )
-    span_constexpr14 reference at( size_type idx ) const
-    {
-#if span_CONFIG( NO_EXCEPTIONS )
-        return this->operator[]( idx );
-#else
-        if ( !detail::is_positive( idx ) || size() <= idx )
-        {
-            detail::throw_out_of_range( idx, size() );
-        }
-        return *( data() + idx );
-#endif
-    }
-#endif
-
-    span_constexpr pointer data() const span_noexcept
-    {
-        return data_;
-    }
-
-#if span_FEATURE( MEMBER_BACK_FRONT )
-
-    span_constexpr_exp reference front() const span_noexcept
-    {
-        span_EXPECTS( ! empty() );
-
-        return *data();
-    }
-
-    span_constexpr_exp reference back() const span_noexcept
-    {
-        span_EXPECTS( ! empty() );
-
-        return *( data() + size() - 1 );
-    }
-
-#endif
-
-    // xx.x.x.x Modifiers [span.modifiers]
-
-#if span_FEATURE( MEMBER_SWAP )
-
-    span_constexpr14 void swap( span & other ) span_noexcept
-    {
-        using std::swap;
-        swap( data_, other.data_ );
-        swap( size_, other.size_ );
-    }
-#endif
-
-    // 26.7.3.6 Iterator support [span.iterators]
-
-    span_constexpr iterator begin() const span_noexcept
-    {
-#if span_CPP11_OR_GREATER
-        return { data() };
-#else
-        return iterator( data() );
-#endif
-    }
-
-    span_constexpr iterator end() const span_noexcept
-    {
-#if span_CPP11_OR_GREATER
-        return { data() + size() };
-#else
-        return iterator( data() + size() );
-#endif
-    }
-
-    span_constexpr const_iterator cbegin() const span_noexcept
-    {
-#if span_CPP11_OR_GREATER
-        return { data() };
-#else
-        return const_iterator( data() );
-#endif
-    }
-
-    span_constexpr const_iterator cend() const span_noexcept
-    {
-#if span_CPP11_OR_GREATER
-        return { data() + size() };
-#else
-        return const_iterator( data() + size() );
-#endif
-    }
-
-    span_constexpr reverse_iterator rbegin() const span_noexcept
-    {
-        return reverse_iterator( end() );
-    }
-
-    span_constexpr reverse_iterator rend() const span_noexcept
-    {
-        return reverse_iterator( begin() );
-    }
-
-    span_constexpr const_reverse_iterator crbegin() const span_noexcept
-    {
-        return const_reverse_iterator ( cend() );
-    }
-
-    span_constexpr const_reverse_iterator crend() const span_noexcept
-    {
-        return const_reverse_iterator( cbegin() );
-    }
-
-private:
-
-    // Note: C++20 has std::pointer_traits<Ptr>::to_address( it );
-
-#if span_HAVE( ITERATOR_CTOR )
-    static inline span_constexpr pointer to_address( std::nullptr_t ) span_noexcept
-    {
-        return nullptr;
-    }
-
-    template< typename U >
-    static inline span_constexpr U * to_address( U * p ) span_noexcept
-    {
-        return p;
-    }
-
-    template< typename Ptr
-        span_REQUIRES_T(( ! std::is_pointer<Ptr>::value ))
-    >
-    static inline span_constexpr pointer to_address( Ptr const & it ) span_noexcept
-    {
-        return to_address( it.operator->() );
-    }
-#endif // span_HAVE( ITERATOR_CTOR )
-
-private:
-    pointer   data_;
-    size_type size_;
-};
-
-// class template argument deduction guides:
-
-#if span_HAVE( DEDUCTION_GUIDES )
-
-template< class T, size_t N >
-span( T (&)[N] ) -> span<T, static_cast<extent_t>(N)>;
-
-template< class T, size_t N >
-span( std::array<T, N> & ) -> span<T, static_cast<extent_t>(N)>;
-
-template< class T, size_t N >
-span( std::array<T, N> const & ) -> span<const T, static_cast<extent_t>(N)>;
-
-#if span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
-
-template< class Container >
-span( Container& ) -> span<typename Container::value_type>;
-
-template< class Container >
-span( Container const & ) -> span<const typename Container::value_type>;
-
-#endif
-
-// iterator: constraints: It satisfies contiguous_­iterator.
-
-template< class It, class EndOrSize >
-span( It, EndOrSize ) -> span< typename std11::remove_reference< typename std20::iter_reference_t<It> >::type >;
-
-#endif // span_HAVE( DEDUCTION_GUIDES )
-
-// 26.7.3.7 Comparison operators [span.comparison]
-
-#if span_FEATURE( COMPARISON )
-#if span_FEATURE( SAME )
-
-template< class T1, extent_t E1, class T2, extent_t E2  >
-inline span_constexpr bool same( span<T1,E1> const & l, span<T2,E2> const & r ) span_noexcept
-{
-    return std11::is_same<T1, T2>::value
-        && l.size() == r.size()
-        && static_cast<void const*>( l.data() ) == r.data();
-}
-
-#endif
-
-template< class T1, extent_t E1, class T2, extent_t E2  >
-inline span_constexpr bool operator==( span<T1,E1> const & l, span<T2,E2> const & r )
-{
-    return
-#if span_FEATURE( SAME )
-        same( l, r ) ||
-#endif
-        ( l.size() == r.size() && std::equal( l.begin(), l.end(), r.begin() ) );
-}
-
-template< class T1, extent_t E1, class T2, extent_t E2  >
-inline span_constexpr bool operator<( span<T1,E1> const & l, span<T2,E2> const & r )
-{
-    return std::lexicographical_compare( l.begin(), l.end(), r.begin(), r.end() );
-}
-
-template< class T1, extent_t E1, class T2, extent_t E2  >
-inline span_constexpr bool operator!=( span<T1,E1> const & l, span<T2,E2> const & r )
-{
-    return !( l == r );
-}
-
-template< class T1, extent_t E1, class T2, extent_t E2  >
-inline span_constexpr bool operator<=( span<T1,E1> const & l, span<T2,E2> const & r )
-{
-    return !( r < l );
-}
-
-template< class T1, extent_t E1, class T2, extent_t E2  >
-inline span_constexpr bool operator>( span<T1,E1> const & l, span<T2,E2> const & r )
-{
-    return ( r < l );
-}
-
-template< class T1, extent_t E1, class T2, extent_t E2  >
-inline span_constexpr bool operator>=( span<T1,E1> const & l, span<T2,E2> const & r )
-{
-    return !( l < r );
-}
-
-#endif // span_FEATURE( COMPARISON )
-
-// 26.7.2.6 views of object representation [span.objectrep]
-
-#if span_HAVE( BYTE ) || span_HAVE( NONSTD_BYTE )
-
-// Avoid MSVC 14.1 (1910), VS 2017: warning C4307: '*': integral constant overflow:
-
-template< typename T, extent_t Extent >
-struct BytesExtent
-{
-#if span_CPP11_OR_GREATER
-    enum ET : extent_t { value = span_sizeof(T) * Extent };
-#else
-    enum ET { value = span_sizeof(T) * Extent };
-#endif
-};
-
-template< typename T >
-struct BytesExtent< T, dynamic_extent >
-{
-#if span_CPP11_OR_GREATER
-    enum ET : extent_t { value = dynamic_extent };
-#else
-    enum ET { value = dynamic_extent };
-#endif
-};
-
-template< class T, extent_t Extent >
-inline span_constexpr span< const std17::byte, BytesExtent<T, Extent>::value >
-as_bytes( span<T,Extent> spn ) span_noexcept
-{
-#if 0
-    return { reinterpret_cast< std17::byte const * >( spn.data() ), spn.size_bytes() };
-#else
-    return span< const std17::byte, BytesExtent<T, Extent>::value >(
-        reinterpret_cast< std17::byte const * >( spn.data() ), spn.size_bytes() );  // NOLINT
-#endif
-}
-
-template< class T, extent_t Extent >
-inline span_constexpr span< std17::byte, BytesExtent<T, Extent>::value >
-as_writable_bytes( span<T,Extent> spn ) span_noexcept
-{
-#if 0
-    return { reinterpret_cast< std17::byte * >( spn.data() ), spn.size_bytes() };
-#else
-    return span< std17::byte, BytesExtent<T, Extent>::value >(
-        reinterpret_cast< std17::byte * >( spn.data() ), spn.size_bytes() );  // NOLINT
-#endif
-}
-
-#endif // span_HAVE( BYTE ) || span_HAVE( NONSTD_BYTE )
-
-// 27.8 Container and view access [iterator.container]
-
-template< class T, extent_t Extent /*= dynamic_extent*/ >
-span_constexpr std::size_t size( span<T,Extent> const & spn )
-{
-    return static_cast<std::size_t>( spn.size() );
-}
-
-template< class T, extent_t Extent /*= dynamic_extent*/ >
-span_constexpr std::ptrdiff_t ssize( span<T,Extent> const & spn )
-{
-    return static_cast<std::ptrdiff_t>( spn.size() );
-}
-
-}  // namespace span_lite
-}  // namespace nonstd
-
-// make available in nonstd:
-
-namespace nonstd {
-
-using span_lite::dynamic_extent;
-
-using span_lite::span;
-
-using span_lite::with_container;
-
-#if span_FEATURE( COMPARISON )
-#if span_FEATURE( SAME )
-using span_lite::same;
-#endif
-
-using span_lite::operator==;
-using span_lite::operator!=;
-using span_lite::operator<;
-using span_lite::operator<=;
-using span_lite::operator>;
-using span_lite::operator>=;
-#endif
-
-#if span_HAVE( BYTE )
-using span_lite::as_bytes;
-using span_lite::as_writable_bytes;
-#endif
-
-using span_lite::size;
-using span_lite::ssize;
-
-}  // namespace nonstd
-
-#endif  // span_USES_STD_SPAN
-
-// make_span() [span-lite extension]:
-
-#if span_FEATURE( MAKE_SPAN ) || span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_SPAN ) || span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_CONTAINER )
-
-#if span_USES_STD_SPAN
-# define  span_constexpr  constexpr
-# define  span_noexcept   noexcept
-# define  span_nullptr    nullptr
-# ifndef  span_CONFIG_EXTENT_TYPE
-#  define span_CONFIG_EXTENT_TYPE  std::size_t
-# endif
-using extent_t = span_CONFIG_EXTENT_TYPE;
-#endif  // span_USES_STD_SPAN
-
-namespace nonstd {
-namespace span_lite {
-
-template< class T >
-inline span_constexpr span<T>
-make_span( T * ptr, size_t count ) span_noexcept
-{
-    return span<T>( ptr, count );
-}
-
-template< class T >
-inline span_constexpr span<T>
-make_span( T * first, T * last ) span_noexcept
-{
-    return span<T>( first, last );
-}
-
-template< class T, std::size_t N >
-inline span_constexpr span<T, static_cast<extent_t>(N)>
-make_span( T ( &arr )[ N ] ) span_noexcept
-{
-    return span<T, static_cast<extent_t>(N)>( &arr[ 0 ], N );
-}
-
-#if span_USES_STD_SPAN || span_HAVE( ARRAY )
-
-template< class T, std::size_t N >
-inline span_constexpr span<T, static_cast<extent_t>(N)>
-make_span( std::array< T, N > & arr ) span_noexcept
-{
-    return span<T, static_cast<extent_t>(N)>( arr );
-}
-
-template< class T, std::size_t N >
-inline span_constexpr span< const T, static_cast<extent_t>(N) >
-make_span( std::array< T, N > const & arr ) span_noexcept
-{
-    return span<const T, static_cast<extent_t>(N)>( arr );
-}
-
-#endif // span_HAVE( ARRAY )
-
-#if span_USES_STD_SPAN || span_HAVE( INITIALIZER_LIST )
-
-template< class T >
-inline span_constexpr span< const T >
-make_span( std::initializer_list<T> il ) span_noexcept
-{
-    return span<const T>( il.begin(), il.size() );
-}
-
-#endif // span_HAVE( INITIALIZER_LIST )
-
-#if span_USES_STD_SPAN
-
-template< class Container, class EP = decltype( std::data(std::declval<Container&>())) >
-inline span_constexpr auto
-make_span( Container & cont ) span_noexcept -> span< typename std::remove_pointer<EP>::type >
-{
-    return span< typename std::remove_pointer<EP>::type >( cont );
-}
-
-template< class Container, class EP = decltype( std::data(std::declval<Container&>())) >
-inline span_constexpr auto
-make_span( Container const & cont ) span_noexcept -> span< const typename std::remove_pointer<EP>::type >
-{
-    return span< const typename std::remove_pointer<EP>::type >( cont );
-}
-
-#elif span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR ) && span_HAVE( AUTO )
-
-template< class Container, class EP = decltype( std17::data(std::declval<Container&>())) >
-inline span_constexpr auto
-make_span( Container & cont ) span_noexcept -> span< typename std::remove_pointer<EP>::type >
-{
-    return span< typename std::remove_pointer<EP>::type >( cont );
-}
-
-template< class Container, class EP = decltype( std17::data(std::declval<Container&>())) >
-inline span_constexpr auto
-make_span( Container const & cont ) span_noexcept -> span< const typename std::remove_pointer<EP>::type >
-{
-    return span< const typename std::remove_pointer<EP>::type >( cont );
-}
-
-#else
-
-template< class T >
-inline span_constexpr span<T>
-make_span( span<T> spn ) span_noexcept
-{
-    return spn;
-}
-
-template< class T, class Allocator >
-inline span_constexpr span<T>
-make_span( std::vector<T, Allocator> & cont ) span_noexcept
-{
-    return span<T>( with_container, cont );
-}
-
-template< class T, class Allocator >
-inline span_constexpr span<const T>
-make_span( std::vector<T, Allocator> const & cont ) span_noexcept
-{
-    return span<const T>( with_container, cont );
-}
-
-#endif // span_USES_STD_SPAN || ( ... )
-
-#if ! span_USES_STD_SPAN && span_FEATURE( WITH_CONTAINER )
-
-template< class Container >
-inline span_constexpr span<typename Container::value_type>
-make_span( with_container_t, Container & cont ) span_noexcept
-{
-    return span< typename Container::value_type >( with_container, cont );
-}
-
-template< class Container >
-inline span_constexpr span<const typename Container::value_type>
-make_span( with_container_t, Container const & cont ) span_noexcept
-{
-    return span< const typename Container::value_type >( with_container, cont );
-}
-
-#endif // ! span_USES_STD_SPAN && span_FEATURE( WITH_CONTAINER )
-
-// extensions: non-member views:
-// this feature implies the presence of make_span()
-
-#if span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_SPAN )
-
-template< extent_t Count, class T, extent_t Extent >
-span_constexpr span<T, Count>
-first( span<T, Extent> spn )
-{
-    return spn.template first<Count>();
-}
-
-template< class T, extent_t Extent >
-span_constexpr span<T>
-first( span<T, Extent> spn, size_t count )
-{
-    return spn.first( count );
-}
-
-template< extent_t Count, class T, extent_t Extent >
-span_constexpr span<T, Count>
-last( span<T, Extent> spn )
-{
-    return spn.template last<Count>();
-}
-
-template< class T, extent_t Extent >
-span_constexpr span<T>
-last( span<T, Extent> spn, size_t count )
-{
-    return spn.last( count );
-}
-
-template< size_t Offset, extent_t Count, class T, extent_t Extent >
-span_constexpr span<T, Count>
-subspan( span<T, Extent> spn )
-{
-    return spn.template subspan<Offset, Count>();
-}
-
-template< class T, extent_t Extent >
-span_constexpr span<T>
-subspan( span<T, Extent> spn, size_t offset, extent_t count = dynamic_extent )
-{
-    return spn.subspan( offset, count );
-}
-
-#endif // span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_SPAN )
-
-#if span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_CONTAINER ) && span_CPP11_120
-
-template< extent_t Count, class T >
-span_constexpr auto
-first( T & t ) -> decltype( make_span(t).template first<Count>() )
-{
-    return make_span( t ).template first<Count>();
-}
-
-template< class T >
-span_constexpr auto
-first( T & t, size_t count ) -> decltype( make_span(t).first(count) )
-{
-    return make_span( t ).first( count );
-}
-
-template< extent_t Count, class T >
-span_constexpr auto
-last( T & t ) -> decltype( make_span(t).template last<Count>() )
-{
-    return make_span(t).template last<Count>();
-}
-
-template< class T >
-span_constexpr auto
-last( T & t, extent_t count ) -> decltype( make_span(t).last(count) )
-{
-    return make_span( t ).last( count );
-}
-
-template< size_t Offset, extent_t Count = dynamic_extent, class T >
-span_constexpr auto
-subspan( T & t ) -> decltype( make_span(t).template subspan<Offset, Count>() )
-{
-    return make_span( t ).template subspan<Offset, Count>();
-}
-
-template< class T >
-span_constexpr auto
-subspan( T & t, size_t offset, extent_t count = dynamic_extent ) -> decltype( make_span(t).subspan(offset, count) )
-{
-    return make_span( t ).subspan( offset, count );
-}
-
-#endif // span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_CONTAINER )
-
-}  // namespace span_lite
-}  // namespace nonstd
-
-// make available in nonstd:
-
-namespace nonstd {
-using span_lite::make_span;
-
-#if span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_SPAN ) || ( span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_CONTAINER ) && span_CPP11_120 )
-
-using span_lite::first;
-using span_lite::last;
-using span_lite::subspan;
-
-#endif // span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_[SPAN|CONTAINER] )
-
-}  // namespace nonstd
-
-#endif // #if span_FEATURE_TO_STD( MAKE_SPAN )
-
-#if span_CPP11_OR_GREATER && span_FEATURE( BYTE_SPAN ) && ( span_HAVE( BYTE ) || span_HAVE( NONSTD_BYTE ) )
-
-namespace nonstd {
-namespace span_lite {
-
-template< class T >
-inline span_constexpr auto
-byte_span( T & t ) span_noexcept -> span< std17::byte, span_sizeof(T) >
-{
-    return span< std17::byte, span_sizeof(t) >( reinterpret_cast< std17::byte * >( &t ), span_sizeof(T) );
-}
-
-template< class T >
-inline span_constexpr auto
-byte_span( T const & t ) span_noexcept -> span< const std17::byte, span_sizeof(T) >
-{
-    return span< const std17::byte, span_sizeof(t) >( reinterpret_cast< std17::byte const * >( &t ), span_sizeof(T) );
-}
-
-}  // namespace span_lite
-}  // namespace nonstd
-
-// make available in nonstd:
-
-namespace nonstd {
-using span_lite::byte_span;
-}  // namespace nonstd
-
-#endif // span_FEATURE( BYTE_SPAN )
-
-#if span_HAVE( STRUCT_BINDING )
-
-#if   span_CPP14_OR_GREATER
-# include <tuple>
-#elif span_CPP11_OR_GREATER
-# include <tuple>
-namespace std {
-    template< std::size_t I, typename T >
-    using tuple_element_t = typename tuple_element<I, T>::type;
-}
-#else
-namespace std {
-    template< typename T >
-    class tuple_size; /*undefined*/
-
-    template< std::size_t I, typename T >
-    class tuple_element; /* undefined */
-}
-#endif // span_CPP14_OR_GREATER
-
-namespace std {
-
-// 26.7.X Tuple interface
-
-// std::tuple_size<>:
-
-template< typename ElementType, nonstd::span_lite::extent_t Extent >
-class tuple_size< nonstd::span<ElementType, Extent> > : public integral_constant<size_t, static_cast<size_t>(Extent)> {};
-
-// std::tuple_size<>: Leave undefined for dynamic extent:
-
-template< typename ElementType >
-class tuple_size< nonstd::span<ElementType, nonstd::dynamic_extent> >;
-
-// std::tuple_element<>:
-
-template< size_t I, typename ElementType, nonstd::span_lite::extent_t Extent >
-class tuple_element< I, nonstd::span<ElementType, Extent> >
-{
-public:
-#if span_HAVE( STATIC_ASSERT )
-    static_assert( Extent != nonstd::dynamic_extent && I < Extent, "tuple_element<I,span>: dynamic extent or index out of range" );
-#endif
-    using type = ElementType;
-};
-
-// std::get<>(), 2 variants:
-
-template< size_t I, typename ElementType, nonstd::span_lite::extent_t Extent >
-span_constexpr ElementType & get( nonstd::span<ElementType, Extent> & spn ) span_noexcept
-{
-#if span_HAVE( STATIC_ASSERT )
-    static_assert( Extent != nonstd::dynamic_extent && I < Extent, "get<>(span): dynamic extent or index out of range" );
-#endif
-    return spn[I];
-}
-
-template< size_t I, typename ElementType, nonstd::span_lite::extent_t Extent >
-span_constexpr ElementType const & get( nonstd::span<ElementType, Extent> const & spn ) span_noexcept
-{
-#if span_HAVE( STATIC_ASSERT )
-    static_assert( Extent != nonstd::dynamic_extent && I < Extent, "get<>(span): dynamic extent or index out of range" );
-#endif
-    return spn[I];
-}
-
-} // end namespace std
-
-#endif // span_HAVE( STRUCT_BINDING )
-
-#if ! span_USES_STD_SPAN
-span_RESTORE_WARNINGS()
-#endif  // span_USES_STD_SPAN
-
-#endif  // NONSTD_SPAN_HPP_INCLUDED
index 1feffbf2b78ae87c84df941b79dc8a691f73ecd4..171ed972c2bf8f2b439a4ea08fcbd80c280d051f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -19,8 +19,8 @@
 #include <ccache/util/bytes.hpp>
 
 #include <doctest/doctest.h>
-#include <nonstd/span.hpp>
 
+#include <span>
 #include <stdexcept>
 #include <string>
 #include <vector>
@@ -452,7 +452,7 @@ TEST_CASE("Basics")
   SUBCASE("Insert span")
   {
     Bytes bytes2;
-    nonstd::span<const uint8_t> span(bytes1.begin(), bytes1.end());
+    std::span<const uint8_t> span(bytes1.begin(), bytes1.end());
 
     bytes2.insert(bytes2.end(), span);
     REQUIRE(bytes2.size() == 3);
@@ -617,14 +617,14 @@ TEST_CASE("Conversion to span")
 
   SUBCASE("Const span")
   {
-    nonstd::span<const uint8_t> span(bytes);
+    std::span<const uint8_t> span(bytes);
     CHECK(span.data() == bytes.data());
     CHECK(span.size() == bytes.size());
   }
 
   SUBCASE("Non-const span")
   {
-    nonstd::span<uint8_t> span(bytes);
+    std::span<uint8_t> span(bytes);
     CHECK(span.data() == bytes.data());
     CHECK(span.size() == bytes.size());
     span[1] = 'x';
index e056a9ae762e75e0d16fc0d12a99f50f081fad1d..0e41f5fba63972dfced2cf45296c5642f461092a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
 //
 // See doc/authors.adoc for a complete list of contributors.
 //
@@ -131,8 +131,7 @@ TEST_CASE("util::to_string")
 
   CHECK(util::to_string(std::string(str)) == std::string(str));
   CHECK(util::to_string(std::string_view(str)) == std::string(str));
-  CHECK(util::to_string(nonstd::span<const uint8_t>(bytes))
-        == std::string(str));
+  CHECK(util::to_string(std::span<const uint8_t>(bytes)) == std::string(str));
   CHECK(util::to_string(util::Bytes(bytes, 3)) == std::string(str));
   CHECK(util::to_string(fs::path("foo/bar")) == std::string("foo/bar"));
 }
@@ -142,7 +141,7 @@ TEST_CASE("util::to_string_view")
   uint8_t bytes[] = {'f', 'o', 'o'};
   char str[] = "foo";
 
-  CHECK(util::to_string_view(nonstd::span(bytes)) == std::string(str));
+  CHECK(util::to_string_view(std::span(bytes)) == std::string(str));
 }
 
 TEST_SUITE_END();