[libcxx-commits] [PATCH] D141947: [NFC][libc++] Remove __unexpected namespace
Yurong via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 17 11:57:53 PST 2023
yronglin created this revision.
Herald added a project: All.
yronglin updated this revision to Diff 489860.
yronglin added a comment.
yronglin updated this revision to Diff 489869.
yronglin edited the summary of this revision.
yronglin added reviewers: philnik, huixie90, Mordante.
yronglin published this revision for review.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Fix expected.h
yronglin added a comment.
Fix unexpected.h
Remove __unexpected namespace.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141947
Files:
libcxx/include/__expected/expected.h
libcxx/include/__expected/unexpected.h
Index: libcxx/include/__expected/unexpected.h
===================================================================
--- libcxx/include/__expected/unexpected.h
+++ libcxx/include/__expected/unexpected.h
@@ -38,28 +38,24 @@
template <class _Err>
class unexpected;
-namespace __unexpected {
-
template <class _Tp>
-struct __is_unexpected : false_type {};
+struct __is_std_unexpected : false_type {};
template <class _Err>
-struct __is_unexpected<unexpected<_Err>> : true_type {};
+struct __is_std_unexpected<unexpected<_Err>> : true_type {};
template <class _Tp>
-using __valid_unexpected = _BoolConstant< //
- is_object_v<_Tp> && //
- !is_array_v<_Tp> && //
- !__is_unexpected<_Tp>::value && //
- !is_const_v<_Tp> && //
- !is_volatile_v<_Tp> //
+using __valid_std_unexpected = _BoolConstant< //
+ is_object_v<_Tp> && //
+ !is_array_v<_Tp> && //
+ !__is_std_unexpected<_Tp>::value && //
+ !is_const_v<_Tp> && //
+ !is_volatile_v<_Tp> //
>;
-} // namespace __unexpected
-
template <class _Err>
class unexpected {
- static_assert(__unexpected::__valid_unexpected<_Err>::value,
+ static_assert(std::__valid_std_unexpected<_Err>::value,
"[expected.un.general] states a program that instantiates std::unexpected for a non-object type, an "
"array type, a specialization of unexpected, or a cv-qualified type is ill-formed.");
Index: libcxx/include/__expected/expected.h
===================================================================
--- libcxx/include/__expected/expected.h
+++ libcxx/include/__expected/expected.h
@@ -81,8 +81,8 @@
!is_function_v<_Tp> &&
!is_same_v<remove_cv_t<_Tp>, in_place_t> &&
!is_same_v<remove_cv_t<_Tp>, unexpect_t> &&
- !__unexpected::__is_unexpected<remove_cv_t<_Tp>>::value &&
- __unexpected::__valid_unexpected<_Err>::value
+ !std::__is_std_unexpected<remove_cv_t<_Tp>>::value &&
+ std::__valid_std_unexpected<_Err>::value
,
"[expected.object.general] A program that instantiates the definition of template expected<T, E> for a "
"reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a "
@@ -198,7 +198,7 @@
template <class _Up = _Tp>
requires(!is_same_v<remove_cvref_t<_Up>, in_place_t> && !is_same_v<expected, remove_cvref_t<_Up>> &&
- !__unexpected::__is_unexpected<remove_cvref_t<_Up>>::value && is_constructible_v<_Tp, _Up>)
+ !std::__is_std_unexpected<remove_cvref_t<_Up>>::value && is_constructible_v<_Tp, _Up>)
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>)
expected(_Up&& __u)
noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened
@@ -357,7 +357,7 @@
template <class _Up = _Tp>
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v)
requires(!is_same_v<expected, remove_cvref_t<_Up>> &&
- !__unexpected::__is_unexpected<remove_cvref_t<_Up>>::value &&
+ !std::__is_std_unexpected<remove_cvref_t<_Up>>::value &&
is_constructible_v<_Tp, _Up> &&
is_assignable_v<_Tp&, _Up> &&
(is_nothrow_constructible_v<_Tp, _Up> ||
@@ -646,7 +646,7 @@
template <class _Tp, class _Err>
requires is_void_v<_Tp>
class expected<_Tp, _Err> {
- static_assert(__unexpected::__valid_unexpected<_Err>::value,
+ static_assert(std::__valid_std_unexpected<_Err>::value,
"[expected.void.general] A program that instantiates expected<T, E> with a E that is not a "
"valid argument for unexpected<E> is ill-formed");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141947.489869.patch
Type: text/x-patch
Size: 3813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230117/4fb93739/attachment.bin>
More information about the libcxx-commits
mailing list