maybe fix span
parent
3b7d3d4d2a
commit
6f2b1c9041
|
@ -291,66 +291,66 @@ namespace blt
|
|||
constexpr span() noexcept: size_(0), data_(nullptr)
|
||||
{}
|
||||
|
||||
template<class It, std::enable_if_t<extent != dynamic_extent, bool> = true>
|
||||
template<class It, std::size_t SIZE, typename std::enable_if_t<extent != dynamic_extent && SIZE == extent, bool> = true>
|
||||
constexpr explicit span(It first, size_type count): size_(count), data_(&*first)
|
||||
{}
|
||||
|
||||
template<class It, std::enable_if_t<extent == dynamic_extent, bool> = true>
|
||||
template<class It, std::size_t SIZE, typename std::enable_if_t<extent == dynamic_extent && SIZE == extent, bool> = true>
|
||||
constexpr span(It first, size_type count): size_(count), data_(&*first)
|
||||
{}
|
||||
|
||||
template<class It, class End, std::enable_if_t<extent != dynamic_extent, bool> = true>
|
||||
template<class It, class End, std::size_t SIZE, typename std::enable_if_t<extent != dynamic_extent && SIZE == extent, bool> = true>
|
||||
constexpr explicit span(It first, End last): size_(&*last - &*first), data_(&*first)
|
||||
{}
|
||||
|
||||
template<class It, class End, std::enable_if_t<extent == dynamic_extent, bool> = true>
|
||||
template<class It, class End, std::size_t SIZE, typename std::enable_if_t<extent == dynamic_extent && SIZE == extent, bool> = true>
|
||||
constexpr span(It first, End last): size_(&*last - &*first), data_(&*first)
|
||||
{}
|
||||
|
||||
template<std::size_t N, std::enable_if_t<(N == dynamic_extent || N == extent) &&
|
||||
template<std::size_t N, typename std::enable_if_t<(N == dynamic_extent || N == extent) &&
|
||||
(std::is_convertible_v<std::remove_pointer_t<decltype(
|
||||
std::data(std::declval<T(&)[N]>()))>(*)[], T(*)[]>), bool> = true>
|
||||
constexpr span(element_type (& arr)[N]) noexcept: size_{N}, data_{arr}
|
||||
{}
|
||||
|
||||
template<class U, std::size_t N, std::enable_if_t<(N == dynamic_extent || N == extent) &&
|
||||
template<class U, std::size_t N, typename std::enable_if_t<(N == dynamic_extent || N == extent) &&
|
||||
(std::is_convertible_v<std::remove_pointer_t<decltype(
|
||||
std::data(std::declval<T(&)[N]>()))>(*)[], T(*)[]>), bool> = true>
|
||||
constexpr span(std::array<U, N>& arr) noexcept: size_(N), data_{arr.data()}
|
||||
{}
|
||||
|
||||
template<class U, std::size_t N, std::enable_if_t<(N == dynamic_extent || N == extent) &&
|
||||
template<class U, std::size_t N, typename std::enable_if_t<(N == dynamic_extent || N == extent) &&
|
||||
(std::is_convertible_v<std::remove_pointer_t<decltype(
|
||||
std::data(std::declval<T(&)[N]>()))>(*)[], T(*)[]>), bool> = true>
|
||||
constexpr span(const std::array<U, N>& arr) noexcept: size_(N), data_{arr.data()}
|
||||
{}
|
||||
|
||||
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, std::enable_if_t<
|
||||
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, typename std::enable_if_t<
|
||||
extent != dynamic_extent && span_detail::is_cont_v<RCV> &&
|
||||
std::is_convertible_v<std::remove_pointer_t<decltype(std::data(std::declval<R>()))>(*)[], T(*)[]>, bool> = true>
|
||||
explicit constexpr span(R&& range): size_(std::size(range)), data_(std::data(range))
|
||||
{}
|
||||
|
||||
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, std::enable_if_t<
|
||||
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, typename std::enable_if_t<
|
||||
extent == dynamic_extent && span_detail::is_cont_v<RCV> &&
|
||||
std::is_convertible_v<std::remove_pointer_t<decltype(std::data(std::declval<R>()))>(*)[], T(*)[]>, bool> = true>
|
||||
constexpr span(R&& range): size_(std::size(range)), data_(std::data(range))
|
||||
{}
|
||||
|
||||
template<std::enable_if_t<extent != dynamic_extent && std::is_const_v<element_type>, bool> = true>
|
||||
template<size_type SIZE, typename std::enable_if_t<extent != dynamic_extent && SIZE == extent && std::is_const_v<element_type>, bool> = true>
|
||||
explicit constexpr span(std::initializer_list<value_type> il) noexcept: size_(il.size()), data_(&il.begin())
|
||||
{}
|
||||
|
||||
template<std::enable_if_t<extent == dynamic_extent && std::is_const_v<element_type>, bool> = true>
|
||||
template<size_type SIZE, typename std::enable_if_t<extent == dynamic_extent && SIZE == extent && std::is_const_v<element_type>, bool> = true>
|
||||
explicit span(std::initializer_list<value_type> il) noexcept: size_(il.size()), data_(&il.begin())
|
||||
{}
|
||||
|
||||
template<class U, std::size_t N, std::enable_if_t<
|
||||
template<class U, std::size_t N, typename std::enable_if_t<
|
||||
extent != dynamic_extent && N == dynamic_extent && std::is_convertible_v<U(*)[], T(*)[]>, bool> = true>
|
||||
explicit constexpr span(const span<U, N>& source) noexcept: size_{source.size()}, data_{source.data()}
|
||||
{}
|
||||
|
||||
template<class U, std::size_t N, std::enable_if_t<
|
||||
template<class U, std::size_t N, typename std::enable_if_t<
|
||||
!(extent != dynamic_extent && N == dynamic_extent) && std::is_convertible_v<U(*)[], T(*)[]>, bool> = true>
|
||||
constexpr span(const span<U, N>& source) noexcept: size_{source.size()}, data_{source.data()}
|
||||
{}
|
||||
|
|
Loading…
Reference in New Issue