...one of the most highly
regarded and expertly designed C++ library projects in the
world.

— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards

## Safe Numerics |

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>`

.

In addition to the expressions defined in Numeric the following expressions must be valid.

Expression | Return Type | Semantics |
---|---|---|

`~t` |
`T` |
bitwise complement |

`t << u` |
`T` |
shift t left u bits |

`t >> u` |
`T` |
shift t right by u bits |

`t & u` |
`V` |
and of t and u padded out to max # bits in t, u |

`t | u` |
`V` |
or of t and u padded out to max # bits in t, u |

`t ^ u` |
`V` |
exclusive or of t and u padded out to max # bits in t, u |

`t <<= u` |
`T` |
left shift the value of t by u bits |

`t >>= u` |
`T` |
right shift the value of t by u bits |

`t &= u` |
`T` |
and the value of t with u and assign to t |

`t |= u` |
`T` |
or the value of t with u and assign to t |

`t ^= u` |
`T` |
exclusive or the value of t with u and assign to t |