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 master branch, built from commit 064f557086.
PrevUpHomeNext

Arithmetic functions

Assume the values

int a = 123;
int b = 256;

The following are all valid expressions returning a+b

plus(arg1, arg2)(a, b)
plus(arg1, b)(a)
plus(a, arg2)(a,b)
plus(a, arg1)(b)
plus(a, b)()

The expressions can be combined like this

plus(minus(a, b),b)()
plus(minus(arg1, b),b)(a)
plus(minus(arg1, arg2),b)(a,b)
plus(minus(arg1, arg2),arg2)(a,b)

Other numerical operators can be used like this

multiplies(arg1,arg2)(3,6)
divides(arg2,arg1)(3,6)
modulus(arg2,arg1)(4,6)
min(arg1,arg2)(4,6)
max(arg1,arg2)(4,6)
inc(arg1)(a)
dec(arg1)(a)
negate(arg1)(a)

PrevUpHomeNext