IsIntegralType (Including Bool)

Function Usage

Checks whether the input data is of integer type, including Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, and Uint64.

If include_bool is set to true, a bool is also included as an integer.

Prototype

bool IsIntergralType(const DataType dtype, const bool include_bool)

Parameters

Parameter

Input/Output

Description

dtype

Input

Input data type.

include_bool

Input

Whether to include a bool as an integer.

Returns

true: integer; false: otherwise.

Constraints

None

Example

1
2
3
4
5
6
// If dtype is not an integer, a return statement is executed. Here, a bool is included as an integer.
void Func(const DataType dtype) {
    if (!IsIntegralType(dtype, true)) {
        return;
    }
}