From 941aa6809c92f05c64ca6624d5898958cfac496d Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 16 Aug 2024 18:36:36 -0400 Subject: [PATCH] update span to have implict copy constructor --- CMakeLists.txt | 2 +- include/blt/std/ranges.h | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b040bc2..c51a842 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.18.33) +set(BLT_VERSION 0.18.34) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/std/ranges.h b/include/blt/std/ranges.h index 91d7509..e2352e7 100644 --- a/include/blt/std/ranges.h +++ b/include/blt/std/ranges.h @@ -436,19 +436,19 @@ namespace blt template()))>(*)[], T(*)[]>), bool> = true> - constexpr span(element_type (& arr)[N]) noexcept: size_{N}, data_{arr} + constexpr span(element_type (& arr)[N]) noexcept: size_{N}, data_{arr} // NOLINT {} template()))>(*)[], T(*)[]>), bool> = true> - constexpr span(std::array& arr) noexcept: size_(N), data_{arr.data()} + constexpr span(std::array& arr) noexcept: size_(N), data_{arr.data()} // NOLINT {} template()))>(*)[], T(*)[]>), bool> = true> - constexpr span(const std::array& arr) noexcept: size_(N), data_{arr.data()} + constexpr span(const std::array& arr) noexcept: size_(N), data_{arr.data()} // NOLINT {} template>, typename std::enable_if_t< @@ -460,17 +460,17 @@ namespace blt template>, typename std::enable_if_t< extent == dynamic_extent && span_detail::is_cont_v && std::is_convertible_v()))>(*)[], T(*)[]>, bool> = true> - constexpr span(R&& range): size_(std::size(range)), data_(std::data(range)) + constexpr span(R&& range): size_(std::size(range)), data_(std::data(range)) // NOLINT {} template, bool> = true> - explicit constexpr span(std::initializer_list il) noexcept: size_(il.size()), data_(&il.begin()) + explicit constexpr span(std::initializer_list il) noexcept: size_(il.size()), data_(&il.begin()) // NOLINT {} template, bool> = true> - explicit span(std::initializer_list il) noexcept: size_(il.size()), data_(&il.begin()) + explicit span(std::initializer_list il) noexcept: size_(il.size()), data_(&il.begin()) // NOLINT {} template, bool> = true> - constexpr span(const span& source) noexcept: size_{source.size()}, data_{source.data()} + constexpr span(const span& source) noexcept: size_{source.size()}, data_{source.data()} // NOLINT {} + constexpr span& operator=(const span& copy) + { + size_ = copy.size(); + data_ = copy.data(); + return *this; + } + constexpr span(const span& other) noexcept = default; constexpr iterator begin() const noexcept