pre-boost Home Libraries People FAQ More

PrevUpHomeNext

Integer<T>

Description
Refinement of
Valid Expressions
Header
Models

Description

A type is Numeric if it has the properties of a number.

More specifically, a type T is Numeric if there exists specialization of std::numeric_limits<T>. See the documentation for standard library class numeric_limits. The standard library includes such specializations for all the primitive numeric types. Note that this concept is distinct from the C++ standard library type traits is_integral and is_arithmetic. These latter fulfill the requirement of the concept Numeric. But there are types T which fulfill this concept for which is_arithmetic<T>::value == false. For example see safe_signed_integer<int>.

Refinement of

Numeric

Valid Expressions

In addition to the expressions defined defined in Numeric the following expressions must be valid. Any operations which result in integers which cannot be represented as some Numeric type will throw an exception.

Table 4. General

Expression Return Value
std::numeric_limits<T>.is_integer true


Header

#include <safe_numerics/include/concepts/numeric.hpp>

Models

int, safe_signed_integer<int>, safe_signed_range<int>, etc.


PrevUpHomeNext