#include <iostream>
#include <limits>
using std::numeric_limits;
using std::cout;
template<typename T> concept bool integerType_c = numeric_limits<T>::is_integer && sizeof(T) == sizeof(int) ;
template<typename T>
concept bool integer_type_c()
{
return requires { sizeof(T) == sizeof(int) && numeric_limits<T>::is_integer;};
}
int main()
{
int x = 1;
if constexpr(integerType_c
<decltype(x)>)
cout << "yeah integer";
else
cout << "oops pls declare an int";
return 0;
}
double x = 1;
if constexpr(integer_type_c<decltype(x)>())
cout << "yeah integer";
else
cout << "oops pls declare an int";
--
You received this message because you are subscribed to the Google Groups "SG8 - Concepts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to concepts+unsubscribe@isocpp.org.
To post to this group, send email to conc...@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/concepts/.
An expression constraint asserts the validity of an expression.
To unsubscribe from this group and stop receiving emails from it, send an email to concepts+u...@isocpp.org.
To unsubscribe from this group and stop receiving emails from it, send an email to concepts+unsubscribe@isocpp.org.