Back to Arangodb

Integer<T>

3rdParty/boost/1.78.0/libs/safe_numerics/doc/html/integer.html

3.12.9.13.2 KB
Original Source

| |

Safe Numerics

|

Integer<T>

Description

A type fulfills the requirements of an Integer if it has the properties of a integer.

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

Refinement of

Numeric

Notation

| T, U, V | A type that is a model of an Integer type | | t, u | An object of type modeling an Integer type | | OS, IS | A type that is a model of an output or input stream | | os, is | An object of a type modeling output or input stream |

Valid Expressions

In addition to the expressions defined in Integer, the following expression must be true.

Table 4. General

ExpressionValue
std::numeric_limits<T>::is_integertrue

Any or all of the following unary operators MAY be defined. Any such defined operators shall implement the semantics as described below

Table 5. Unary Operator

ExpressionReturn TypeSemantics
~tTbitwise complement

Any or all of the following binary operators MAY be defined. Any defined operators shall implement the semantics as described bellow

Table 6. Binary Operators

ExpressionReturn TypeSemantics
t % uTt modulus u. t can be a Numeric type.
t << uTshift t left u bits
t >> uTshift t right by u bits
t & uVand of t and u padded out to max # bits in t, u
`tu`V
t ^ uVexclusive or of t and u padded out to max # bits in t, u
t <<= uTleft shift the value of t by u bits
t >>= uTright shift the value of t by u bits
t &= uTand the value of t with u and assign to t
`t= u`T
t ^= uTexclusive or the value of t with u and assign to t
os << tOS &write contents of t to output stream
is >> tIS &read contents of an input stream into t

Models

int, safe<int>, safe_unsigned_range<0, 11>, checked_result<int> etc.

Header

#include <boost/safe_numerics/concepts/integer.hpp>

| | Copyright © 2012-2018 Robert Ramey

Subject to Boost Software License

|