Calculator Step 6

- Main Page
- Classes
- Files

- File List
- File Members

Functions
power10.hpp File Reference

Go to the source code of this file.

## Functions
template<class T >
T constexpr | power10_helper (T n, T result)
| Called from power10 to compute 10`n`, storing the result so far in `result`. More...
template<class T >
T constexpr | power10 (T n)
| Compute a power of 10 at compile time. The type T must support subtraction and multiplication. More...

## Function Documentation

template<class T >

T constexpr power10 | ( | T | n | ) |

Compute a power of 10 at compile time. The type T must support subtraction and multiplication.

Definition at line 14 of file power10.hpp.

References power10_helper().

15 {
16 return power10_helper(n, T{1});
17 }
power10_helper
T constexpr power10_helper(T n, T result)
Called from power10 to compute 10n, storing the result so far in result.
Definition: power10.hpp:7
template<class T >

T constexpr power10_helper | ( | T | n,
|  | T | result
| ) |  |

Called from power10 to compute 10`n`, storing the result so far in `result`.

Definition at line 7 of file power10.hpp.

Referenced by power10().

8 {
9 return n == T{} ? result : power10_helper(n - T{1}, T{10} * result);
10 }
power10_helper
T constexpr power10_helper(T n, T result)
Called from power10 to compute 10n, storing the result so far in result.
Definition: power10.hpp:7