I created a Matrix class, using
static_assert(std::is_arithmetic<T>::value,"");
to check if the template type is an arithmetic type. So I tried with
Matrix<char> matrix1(3,3); // ctor takes number of rows and columns
and it works. The static_assert function is not called with char type. It is normal? char is seen like an arithmetic type?
From the reference:
If T is an arithmetic type (that is, an integral type or a floating-point type), provides the member constant value equal true. For any other type, value is false.
char
is an integral type, so the answer is true
. The fact that the small integers that fit in a char
are often interpreted as codepoints in a particular character encoding space is secondary.