Giriş
C++20 ile geliyor. requires constaint ve requires expression diye iki farklı kavram var.
Açıklaması şöyle
Açıklaması şöyle.
C++20 ile geliyor. requires constaint ve requires expression diye iki farklı kavram var.
Açıklaması şöyle
A requires constraint does not have to use a requires expression. It can use any more-or-less arbitrary boolean constant expression. Therefore, requires (foo) must be a legitimate requires constraint.Örnek - expression
A requires expression (that thing that tests whether certain things follow certain constraints) is a distinct construct; it's just introduced by the same keyword. requires (foo f) would be the beginning of a valid requires expression.
Açıklaması şöyle.
Şöyle yaparız.A requires-expression can also be used in a requires-clause ([temp]) as a way of writing ad hoc constraints on template argumentsThe first requires introduces the requires-clause, and the second introduces the requires-expression.
template<typename T>
requires requires (T x) { x + x; }
T add(T a, T b) { return a + b; }
Hiç yorum yok:
Yorum Gönder