[libcxx-commits] [PATCH] D69827: [libcxx] Remove swap for std::span
Jan Wilken Dörrie via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 4 14:08:15 PST 2019
jdoerrie created this revision.
jdoerrie added a reviewer: mclow.lists.
Herald added a reviewer: EricWF.
Herald added subscribers: ldionne, christof.
This change removes both the member function swap and the free function overload of swap for std::span. While swap is a member and overloaded for every other container in the standard library [1], it is neither a member function nor a free function overload for std::span [2]. Thus the corresponding implementation should be removed.
[1] https://eel.is/c++draft/libraryindex#:swap
[2] https://eel.is/c++draft/span.overview
Repository:
rCXX libc++
https://reviews.llvm.org/D69827
Files:
libcxx/include/span
Index: libcxx/include/span
===================================================================
--- libcxx/include/span
+++ libcxx/include/span
@@ -329,13 +329,6 @@
_LIBCPP_INLINE_VISIBILITY constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
_LIBCPP_INLINE_VISIBILITY constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
- _LIBCPP_INLINE_VISIBILITY constexpr void swap(span &__other) noexcept
- {
- pointer __p = __data;
- __data = __other.__data;
- __other.__data = __p;
- }
-
_LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept
{ return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
@@ -499,17 +492,6 @@
_LIBCPP_INLINE_VISIBILITY constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
_LIBCPP_INLINE_VISIBILITY constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
- _LIBCPP_INLINE_VISIBILITY constexpr void swap(span &__other) noexcept
- {
- pointer __p = __data;
- __data = __other.__data;
- __other.__data = __p;
-
- index_type __sz = __size;
- __size = __other.__size;
- __other.__size = __sz;
- }
-
_LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept
{ return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
@@ -562,12 +544,6 @@
-> enable_if_t<!is_const_v<_Tp>, decltype(__s.__as_writable_bytes())>
{ return __s.__as_writable_bytes(); }
-template <class _Tp, size_t _Extent>
-_LIBCPP_INLINE_VISIBILITY
-constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept
-{ __lhs.swap(__rhs); }
-
-
// Deduction guides
template<class _Tp, size_t _Sz>
span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69827.227778.patch
Type: text/x-patch
Size: 1954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191104/26ce768c/attachment.bin>
More information about the libcxx-commits
mailing list