PrevUpHomeNext

Type trait arithmetic_category

In C++, the term arithmetic type refers to a fundamental type which is either integral or floating point.

As part of the definition of safely_constructible, strict_variant makes a finer classification of these types, and assigns a portable conversion rank to each such type.

The type trait arithmetic_category computes the category of a given arithmetic type.

Declaration

namespace strict_variant {
namespace mpl {

enum class arithmetic_category : char { integer, character, wide_char, boolean, floating };

template <typename T, typename ENABLE = void>
struct classify_arithmetic;

} // end namespace mpl
} // end namespace strict_variant

Valid Expressions

expression

value

T

any arithmetic type

strict_variant::mpl::classify_arithmetic<T>::value

The arithmetic_category of T.

Definition

Fundmental Type

arithmetic_category

(unsigned) short

integer

(unsigned) int

(unsigned) long

(unsigned) long long

 

signed char

character

char

unsigned char

char16_t

char32_t

float

floating

double

long double

bool

boolean

wchar_t

wide_char

[Note] Note

You are free to specialize this trait to support other arithmetic types, such as implementation-specific extended integers.

By default, any type for which std::is_integral reports true and which is not listed above will be categorized as integer.


PrevUpHomeNext