conjunction<B1, ..., BN> is the first type Bi in the list true_type, B1, ..., BN for which Bi::value == false, or if every Bi::value != false the BaseCharacteristic is BN. [Note: This means a specialization of conjunction does not necessarily have a BaseCharacteristic of either true_type or false_type. — end note]disjunction<B1, ..., BN> is the first type Bi in the list false_type, B1, ..., BN for which Bi::value != false, or if every Bi::value == false the BaseCharacteristic is BN. [Note: This means a specialization of disjunction does not necessarily have a BaseCharacteristic of either true_type or false_type. — end note]template<class...> struct conjunction : std::true_type { };
template<class B1> struct conjunction<B1> : B1 { };
template<class B1, class... Bn>
struct conjunction<B1, Bn...>
: std::conditional_t<bool(B1::value), conjunction<Bn...>, B1> {};
template<class...> struct disjunction : std::false_type { };
template<class B1> struct disjunction<B1> : B1 { };
template<class B1, class... Bn>
struct disjunction<B1, Bn...>
: std::conditional_t<bool(B1::value), B1, disjunction<Bn...>> { };
template <bool... Bn>
struct __bools {};
template <typename... Tn>
struct greedy_disjunction: std::negation<std::is_same<__bools<bool(Tn::value)...>, __bools<(Tn::value && false)...>>> {};
template <typename... Tn>
struct greedy_conjunction: std::is_same<__bools<bool(Tn::value)...>, __bools<(Tn::value || true)...>> {};
template <typename... Tn>
struct greedy_disjunction : std::bool_constant<(false || ... || bool(Tn::value))> {};
template <typename... Tn>
struct greedy_conjunction : std::bool_constant<(true && ... && bool(Tn::value))> {};
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/a79ce0b4-ca2d-4c37-b49e-cb707689a0e2%40isocpp.org.
What I meant is that you don't really need a specific trait.
You can't obtain the result of std::{con,dis}junction directly, without using a layer of abstraction for the laziness.
You can, however, obtain the result of the greedy operation directly - by just &&ing or ||ing the values of the traits you'd pass to this trait. Evaluation in templates is already eager that way, and it's no problem to && or || them together even in generic contexts, especially since we have fold expressions now.
The reason for the traits that we have is laziness. If you don't need laziness, you don't need the trait.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/81a6a1fa-a331-483e-8f4d-4184c661b106%40isocpp.org.