diff options
Diffstat (limited to 'include/o3tl/span.hxx')
-rw-r--r-- | include/o3tl/span.hxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx index 8af8ba846b65..087d1f9d69c3 100644 --- a/include/o3tl/span.hxx +++ b/include/o3tl/span.hxx @@ -25,6 +25,7 @@ namespace o3tl { using std::span; } #include <cassert> #include <cstddef> #include <iterator> +#include <type_traits> namespace o3tl { @@ -57,6 +58,10 @@ public: assert(a != nullptr || len == 0); } + /** for assigning from span<T> to span<const T> */ + constexpr span (const span<typename std::remove_const<T>::type>& other) noexcept + : data_(other.data()), size_(other.size()) {} + constexpr bool empty() const noexcept { return size_ == 0; } constexpr iterator begin() const noexcept { return data_; } |