В следующем коде: < /p>
#include
#include
#include
struct A{
A(int){};
};
bool operator std::same_as; }){
//alternative 2)
if constexpr(requires(T v){ {std::numeric_limits::lowest() < v} -> std::same_as; }){
if (std::numeric_limits::lowest() < v){
std::cout
Почему с альтернативой 2) требуется экспрессия оценивается как истина? Признайте t -> Godbolt).
Подробнее здесь: https://stackoverflow.com/questions/794 ... valid-code