Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2968R2 Make std::ignore A First-Class Object #4777

Merged
merged 5 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions stl/inc/tuple
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@ struct _Tuple_perfect_val<tuple<_Ty0, _Ty1, _Ty2>, _Uty0, _Uty1, _Uty2>
: bool_constant<disjunction_v<negation<is_same<_Remove_cvref_t<_Uty0>, allocator_arg_t>>,
is_same<_Remove_cvref_t<_Ty0>, allocator_arg_t>>> {};

struct _Ignore { // struct that ignores assignments
template <class _Ty>
constexpr const _Ignore& operator=(const _Ty&) const noexcept /* strengthened */ {
// do nothing
return *this;
}
};

_EXPORT_STD _INLINE_VAR constexpr _Ignore ignore{};

// Note: To improve throughput, this file uses extra _STD qualification for names that appear in the
// arguments of enable_if_t. Specifically, we qualify names which appear anywhere in the STL as members of
// some class - including injected-class-names! - that we know are not members of the class being defined.
Expand Down
10 changes: 10 additions & 0 deletions stl/inc/utility
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ _EXPORT_STD struct piecewise_construct_t { // tag type for pair tuple arguments

_EXPORT_STD _INLINE_VAR constexpr piecewise_construct_t piecewise_construct{};

_EXPORT_STD struct _Ignore { // struct that ignores assignments
template <class _Ty>
constexpr const _Ignore& operator=(const _Ty&) const noexcept {
// do nothing
return *this;
}
};

_EXPORT_STD _INLINE_VAR constexpr _Ignore ignore{};

_EXPORT_STD template <class... _Types>
class tuple;

Expand Down
1 change: 1 addition & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
// P2407R5 Freestanding Library: Partial Classes
// (__cpp_lib_freestanding_algorithm and __cpp_lib_freestanding_array only)
// P2937R0 Freestanding Library: Remove strtok
// P2968R2 Make std::ignore A First-Class Object

// _HAS_CXX17 directly controls:
// P0005R4 not_fn()
Expand Down