From: Louis Dionne Date: Fri, 21 Oct 2022 16:25:29 +0000 (-0400) Subject: [libc++][NFC] Add documentation for _Or and _And X-Git-Tag: upstream/17.0.6~29904 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc41512fd3e36fe26e9ff3aa53493c5dcf75b506;p=platform%2Fupstream%2Fllvm.git [libc++][NFC] Add documentation for _Or and _And --- diff --git a/libcxx/include/__type_traits/conjunction.h b/libcxx/include/__type_traits/conjunction.h index 9715854..2802d28 100644 --- a/libcxx/include/__type_traits/conjunction.h +++ b/libcxx/include/__type_traits/conjunction.h @@ -29,6 +29,11 @@ __expand_to_true<__enable_if_t<_Pred::value>...> __and_helper(int); template false_type __and_helper(...); +// _And always performs lazy evaluation of its arguments. +// +// However, `_And<_Pred...>` itself will evaluate its result immediately (without having to +// be instantiated) since it is an alias, unlike `conjunction<_Pred...>`, which is a struct. +// If you want to defer the evaluation of `_And<_Pred...>` itself, use `_Lazy<_And, _Pred...>`. template using _And _LIBCPP_NODEBUG = decltype(__and_helper<_Pred...>(0)); diff --git a/libcxx/include/__type_traits/disjunction.h b/libcxx/include/__type_traits/disjunction.h index 465411a..125f168 100644 --- a/libcxx/include/__type_traits/disjunction.h +++ b/libcxx/include/__type_traits/disjunction.h @@ -34,6 +34,12 @@ struct _OrImpl { using _Result = _Res; }; +// _Or always performs lazy evaluation of its arguments. +// +// However, `_Or<_Pred...>` itself will evaluate its result immediately (without having to +// be instantiated) since it is an alias, unlike `disjunction<_Pred...>`, which is a struct. +// If you want to defer the evaluation of `_Or<_Pred...>` itself, use `_Lazy<_Or, _Pred...>` +// or `disjunction<_Pred...>` directly. template using _Or _LIBCPP_NODEBUG = typename _OrImpl::template _Result;