diff options
author | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-10-09 12:29:46 +0300 |
---|---|---|
committer | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-10-09 13:14:22 +0300 |
commit | 9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch) | |
tree | a8fb3181d5947c0d78cf402aa56e686130179049 /contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch | |
parent | a44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff) | |
download | ydb-9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80.tar.gz |
publishFullContrib: true for ydb
<HIDDEN_URL>
commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch')
-rw-r--r-- | contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch new file mode 100644 index 0000000000..76af4fa297 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/patches/42-span.patch @@ -0,0 +1,126 @@ +diff --git a/include/span b/include/span +index 46df783..0101dcb 100644 +--- a/include/span ++++ b/include/span +@@ -181,6 +181,29 @@ concept __span_compatible_range = + !__is_std_array<remove_cvref_t<_Range>>::value && + !is_array_v<remove_cvref_t<_Range>> && + is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>; ++#else ++template <class _Tp, class _ElementType, class = void> ++struct __is_span_compatible_container : public false_type {}; ++ ++template <class _Tp, class _ElementType> ++struct __is_span_compatible_container<_Tp, _ElementType, ++ void_t< ++ // is not a specialization of span ++ enable_if_t<!__is_std_span<_Tp>::value, nullptr_t>, ++ // is not a specialization of array ++ enable_if_t<!__is_std_array<_Tp>::value, nullptr_t>, ++ // is_array_v<Container> is false, ++ enable_if_t<!is_array_v<_Tp>, nullptr_t>, ++ // data(cont) and size(cont) are well formed ++ decltype(data(declval<_Tp>())), ++ decltype(size(declval<_Tp>())), ++ // remove_pointer_t<decltype(data(cont))>(*)[] is convertible to ElementType(*)[] ++ enable_if_t< ++ is_convertible_v<remove_pointer_t<decltype(data(declval<_Tp &>()))>(*)[], ++ _ElementType(*)[]>, ++ nullptr_t> ++ >> ++ : public true_type {}; + #endif + + template <typename _Tp, size_t _Extent> +@@ -235,6 +258,11 @@ public: + _LIBCPP_ASSERT(__last - __first == _Extent, + "invalid range in span's constructor (iterator, sentinel): last - first != extent"); + } ++#else ++ _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __ptr, size_type __count) : __data{__ptr} ++ { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); } ++ _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __f, pointer __l) : __data{__f} ++ { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); } + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) + + _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data{__arr} {} +@@ -255,6 +283,22 @@ public: + constexpr explicit span(_Range&& __r) : __data{ranges::data(__r)} { + _LIBCPP_ASSERT(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)"); + } ++#else ++ template <class _Container> ++ _LIBCPP_INLINE_VISIBILITY ++ constexpr explicit span( _Container& __c, ++ enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) ++ : __data{_VSTD::data(__c)} { ++ _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)"); ++ } ++ ++ template <class _Container> ++ _LIBCPP_INLINE_VISIBILITY ++ constexpr explicit span(const _Container& __c, ++ enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr) ++ : __data{_VSTD::data(__c)} { ++ _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)"); ++ } + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + + template <class _OtherElementType> +@@ -419,6 +463,9 @@ public: + _LIBCPP_INLINE_VISIBILITY + constexpr span(_It __first, _End __last) + : __data(_VSTD::to_address(__first)), __size(__last - __first) {} ++#else ++ _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}, __size{__count} {} ++ _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {} + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) + + template <size_t _Sz> +@@ -439,6 +486,18 @@ public: + template <__span_compatible_range<element_type> _Range> + _LIBCPP_INLINE_VISIBILITY + constexpr span(_Range&& __r) : __data(ranges::data(__r)), __size{ranges::size(__r)} {} ++#else ++ template <class _Container> ++ _LIBCPP_INLINE_VISIBILITY ++ constexpr span( _Container& __c, ++ enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) ++ : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} ++ ++ template <class _Container> ++ _LIBCPP_INLINE_VISIBILITY ++ constexpr span(const _Container& __c, ++ enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr) ++ : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} + #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + + template <class _OtherElementType, size_t _OtherExtent> +@@ -533,17 +592,23 @@ public: + _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } + _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } + +- _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept +- { return {reinterpret_cast<const byte *>(data()), size_bytes()}; } ++ inline _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept; + +- _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept +- { return {reinterpret_cast<byte *>(data()), size_bytes()}; } ++ inline _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept; + + private: + pointer __data; + size_type __size; + }; + ++template<typename _Tp> ++inline _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> span<_Tp, dynamic_extent>::__as_bytes() const noexcept ++{ return {reinterpret_cast<const byte *>(data()), size_bytes()}; } ++ ++template<typename _Tp> ++inline _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> span<_Tp, dynamic_extent>::__as_writable_bytes() const noexcept ++{ return {reinterpret_cast<byte *>(data()), size_bytes()}; } ++ + #if !defined(_LIBCPP_HAS_NO_CONCEPTS) + template <class _Tp, size_t _Extent> + inline constexpr bool ranges::enable_borrowed_range<span<_Tp, _Extent> > = true; |