Compat

Function Usage

Checks whether the value of an input parameter is beyond the value range that can be represented by the specified data type T.

Prototype

template<typename T1>

static bool Compat(const T1 v)

Parameters

Table 1 Parameters in the template

Parameter

Description

T1

Type of the value to be checked. The value can be a signed integer or unsigned integer, for example, int64_t or uint32_t.

Table 2 Parameters

Parameter

Input/Output

Description

v

Input

Value to be checked. The type is T1.

Returns

Return value of the Boolean type:

  • If the value v is within the representation range of the data type T, true is returned.
  • If the value v is beyond the representation range of the data type T, false is returned.

Constraints

None

Examples

1
2
3
4
const int64_t value = XXX;
if (!ge::IntegerChecker<int32_t>::Compat(value)) {
   // Error reported
}