Skip to content

Commit fc41512

Browse files
committed
[libc++][NFC] Add documentation for _Or and _And
1 parent 07d8fe9 commit fc41512

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

libcxx/include/__type_traits/conjunction.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ __expand_to_true<__enable_if_t<_Pred::value>...> __and_helper(int);
2929
template <class...>
3030
false_type __and_helper(...);
3131

32+
// _And always performs lazy evaluation of its arguments.
33+
//
34+
// However, `_And<_Pred...>` itself will evaluate its result immediately (without having to
35+
// be instantiated) since it is an alias, unlike `conjunction<_Pred...>`, which is a struct.
36+
// If you want to defer the evaluation of `_And<_Pred...>` itself, use `_Lazy<_And, _Pred...>`.
3237
template <class... _Pred>
3338
using _And _LIBCPP_NODEBUG = decltype(__and_helper<_Pred...>(0));
3439

libcxx/include/__type_traits/disjunction.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ struct _OrImpl<false> {
3434
using _Result = _Res;
3535
};
3636

37+
// _Or always performs lazy evaluation of its arguments.
38+
//
39+
// However, `_Or<_Pred...>` itself will evaluate its result immediately (without having to
40+
// be instantiated) since it is an alias, unlike `disjunction<_Pred...>`, which is a struct.
41+
// If you want to defer the evaluation of `_Or<_Pred...>` itself, use `_Lazy<_Or, _Pred...>`
42+
// or `disjunction<_Pred...>` directly.
3743
template <class... _Args>
3844
using _Or _LIBCPP_NODEBUG = typename _OrImpl<sizeof...(_Args) != 0>::template _Result<false_type, _Args...>;
3945

0 commit comments

Comments
 (0)