// a sample program using concepts // tested in gcc and clang template <typename T> concept has_a = requires(T v) { v.a(); }; template <typename T> requires has_a<T> void fun(T v) { v.a(); }| godbolt.org
template <typename T> struct wrapper { T _value; void operator() () requires std::is_invocable_v<T> { _value(); } void reset(T v) { _value = v; } }; // explicit instantiation: template struct wrapper<int>;| godbolt.org
Short-circuiting in logical operations is a very useful and an often used feature: Should cond_a() evaluate to false, cond_b() is guaranteed not to be evaluated. This is useful for two reasons. One…| Andrzej's C++ blog
This post contains quite advanced material. I assume you are already familiar with Concepts Lite. For an overview of what Concepts Lite is, I recommend this proposal. Also, I have found this blog v…| Andrzej's C++ blog
Certain combinations of types and expressions can make a C++ program ill-formed. “Ill-formed” is a term taken from the C++ Standard and it means that a program is not valid, and compile…| Andrzej's C++ blog