Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit b5267c6e8a.
Library Documentation Index

Safe Numerics

Next

Safe Numerics

Robert Ramey

Table of Contents

Introduction
Problem
Solution
How It Works
Additional Features
Requirements
Scope
Tutorial and Motivating Examples
Arithmetic Expressions Can Yield Incorrect Results
Arithmetic Operations Can Overflow Silently
Arithmetic on Unsigned Integers Can Yield Incorrect Results
Implicit Conversions Can Lead to Erroneous Results
Mixing Data Types Can Create Subtle Errors
Array Index Value Can Exceed Array Limits
Checking of Input Values Can Be Easily Overlooked
Cannot Recover From Arithmetic Errors
Compile Time Arithmetic is Not Always Correct
Programming by Contract is Too Slow
Eliminating Runtime Penalty
Using safe_range and safe_literal
Using Automatic Type Promotion
Mixing Approaches
Case Studies
Composition with Other Libraries
Safety Critical Embedded Controller
Background
Type Requirements
Numeric<T>
Integer<T>
PromotionPolicy<PP>
ExceptionPolicy<EP>
Types
safe<T, PP, EP>
safe_signed_range<MIN, MAX, PP, EP> and safe_unsigned_range<MIN, MAX, PP, EP>
safe_signed_literal<Value, PP , EP> and safe_unsigned_literal<Value, PP, EP>
exception
exception_policy<AE, IDB, UB, UV>
Promotion Policies
Exception Safety
Library Implementation
checked_result<R>
Checked Arithmetic
interval<R>
safe_compare<T, U>
Performance Tests
Rationale and FAQ
Pending Issues
safe_base Only Works for Scalar Types
Other Pending Issues
Acknowledgements
Release Log
Bibliography

Last revised: $Date


Next