[libcxx-commits] [PATCH] D115687: [libc++] Make __compressed_pair fully constexpr
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 13 17:17:40 PST 2021
philnik updated this revision to Diff 394094.
philnik added a comment.
Added spaces
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115687/new/
https://reviews.llvm.org/D115687
Files:
libcxx/include/__memory/compressed_pair.h
Index: libcxx/include/__memory/compressed_pair.h
===================================================================
--- libcxx/include/__memory/compressed_pair.h
+++ libcxx/include/__memory/compressed_pair.h
@@ -58,10 +58,8 @@
: __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
#endif
-
- _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return __value_; }
- _LIBCPP_INLINE_VISIBILITY
- const_reference __get() const _NOEXCEPT { return __value_; }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 reference __get() _NOEXCEPT { return __value_; }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return __value_; }
private:
_Tp __value_;
@@ -97,9 +95,8 @@
: __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
#endif
- _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return *this; }
- _LIBCPP_INLINE_VISIBILITY
- const_reference __get() const _NOEXCEPT { return *this; }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 reference __get() _NOEXCEPT { return *this; }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return *this; }
};
template <class _T1, class _T2>
@@ -143,23 +140,19 @@
typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}
#endif
- _LIBCPP_INLINE_VISIBILITY
- typename _Base1::reference first() _NOEXCEPT {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename _Base1::reference first() _NOEXCEPT {
return static_cast<_Base1&>(*this).__get();
}
- _LIBCPP_INLINE_VISIBILITY
- typename _Base1::const_reference first() const _NOEXCEPT {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename _Base1::const_reference first() const _NOEXCEPT {
return static_cast<_Base1 const&>(*this).__get();
}
- _LIBCPP_INLINE_VISIBILITY
- typename _Base2::reference second() _NOEXCEPT {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename _Base2::reference second() _NOEXCEPT {
return static_cast<_Base2&>(*this).__get();
}
- _LIBCPP_INLINE_VISIBILITY
- typename _Base2::const_reference second() const _NOEXCEPT {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename _Base2::const_reference second() const _NOEXCEPT {
return static_cast<_Base2 const&>(*this).__get();
}
@@ -172,11 +165,8 @@
return static_cast<_Base2*>(__pair);
}
- _LIBCPP_INLINE_VISIBILITY
- void swap(__compressed_pair& __x)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value)
- {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 void swap(__compressed_pair& __x)
+ _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) {
using _VSTD::swap;
swap(first(), __x.first());
swap(second(), __x.second());
@@ -184,10 +174,9 @@
};
template <class _T1, class _T2>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
void swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value) {
+ _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) {
__x.swap(__y);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115687.394094.patch
Type: text/x-patch
Size: 3355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211214/27c4c9e8/attachment.bin>
More information about the libcxx-commits
mailing list