File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 2194
2194
This is analogous to the short-circuiting behavior of
2195
2195
the built-in operator \tcode {\&\& }.
2196
2196
\end {note }
2197
+ \begin {note }
2198
+ This allows types without a \tcode {value} static data member
2199
+ to be template arguments for \tcode {conjunction}, as long as an
2200
+ earlier argument evaluates to \tcode {false}, for example:
2201
+ \begin {codeblock }
2202
+ template<class T>
2203
+ concept HasValue = requires { { T::value } -> std::convertible_to<bool>; };
2204
+ template<class T>
2205
+ using maybe_value = std::conjunction<std::bool_constant<HasValue<T>>, T>;
2206
+
2207
+ struct X { };
2208
+
2209
+ static_assert( ! maybe_value<X>::value ); // OK, \tcode {X::value} not used
2210
+ static_assert( ! maybe_value<int>::value ); // OK, \tcode {int::value} not used
2211
+ static_assert( maybe_value<std::true_type>::value );
2212
+ \end {codeblock }
2213
+ \end {note }
2197
2214
2198
2215
\pnum
2199
2216
Every template type argument
You can’t perform that action at this time.
0 commit comments