Skip to content

Commit 002b190

Browse files
committed
[NFC][libc++] Remove __unexpected namespace
Remove __unexpected namespace. Reviewed By: philnik, #libc, ldionne Differential Revision: https://reviews.llvm.org/D141947
1 parent 4f2a461 commit 002b190

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

libcxx/include/__expected/expected.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ class expected {
8181
!is_function_v<_Tp> &&
8282
!is_same_v<remove_cv_t<_Tp>, in_place_t> &&
8383
!is_same_v<remove_cv_t<_Tp>, unexpect_t> &&
84-
!__unexpected::__is_unexpected<remove_cv_t<_Tp>>::value &&
85-
__unexpected::__valid_unexpected<_Err>::value
84+
!__is_std_unexpected<remove_cv_t<_Tp>>::value &&
85+
__valid_std_unexpected<_Err>::value
8686
,
8787
"[expected.object.general] A program that instantiates the definition of template expected<T, E> for a "
8888
"reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a "
@@ -198,7 +198,7 @@ class expected {
198198

199199
template <class _Up = _Tp>
200200
requires(!is_same_v<remove_cvref_t<_Up>, in_place_t> && !is_same_v<expected, remove_cvref_t<_Up>> &&
201-
!__unexpected::__is_unexpected<remove_cvref_t<_Up>>::value && is_constructible_v<_Tp, _Up>)
201+
!__is_std_unexpected<remove_cvref_t<_Up>>::value && is_constructible_v<_Tp, _Up>)
202202
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>)
203203
expected(_Up&& __u)
204204
noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened
@@ -357,7 +357,7 @@ class expected {
357357
template <class _Up = _Tp>
358358
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v)
359359
requires(!is_same_v<expected, remove_cvref_t<_Up>> &&
360-
!__unexpected::__is_unexpected<remove_cvref_t<_Up>>::value &&
360+
!__is_std_unexpected<remove_cvref_t<_Up>>::value &&
361361
is_constructible_v<_Tp, _Up> &&
362362
is_assignable_v<_Tp&, _Up> &&
363363
(is_nothrow_constructible_v<_Tp, _Up> ||
@@ -648,7 +648,7 @@ class expected {
648648
template <class _Tp, class _Err>
649649
requires is_void_v<_Tp>
650650
class expected<_Tp, _Err> {
651-
static_assert(__unexpected::__valid_unexpected<_Err>::value,
651+
static_assert(__valid_std_unexpected<_Err>::value,
652652
"[expected.void.general] A program that instantiates expected<T, E> with a E that is not a "
653653
"valid argument for unexpected<E> is ill-formed");
654654

libcxx/include/__expected/unexpected.h

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3838
template <class _Err>
3939
class unexpected;
4040

41-
namespace __unexpected {
42-
4341
template <class _Tp>
44-
struct __is_unexpected : false_type {};
42+
struct __is_std_unexpected : false_type {};
4543

4644
template <class _Err>
47-
struct __is_unexpected<unexpected<_Err>> : true_type {};
45+
struct __is_std_unexpected<unexpected<_Err>> : true_type {};
4846

4947
template <class _Tp>
50-
using __valid_unexpected = _BoolConstant< //
51-
is_object_v<_Tp> && //
52-
!is_array_v<_Tp> && //
53-
!__is_unexpected<_Tp>::value && //
54-
!is_const_v<_Tp> && //
55-
!is_volatile_v<_Tp> //
48+
using __valid_std_unexpected = _BoolConstant< //
49+
is_object_v<_Tp> && //
50+
!is_array_v<_Tp> && //
51+
!__is_std_unexpected<_Tp>::value && //
52+
!is_const_v<_Tp> && //
53+
!is_volatile_v<_Tp> //
5654
>;
5755

58-
} // namespace __unexpected
59-
6056
template <class _Err>
6157
class unexpected {
62-
static_assert(__unexpected::__valid_unexpected<_Err>::value,
58+
static_assert(__valid_std_unexpected<_Err>::value,
6359
"[expected.un.general] states a program that instantiates std::unexpected for a non-object type, an "
6460
"array type, a specialization of unexpected, or a cv-qualified type is ill-formed.");
6561

0 commit comments

Comments
 (0)