C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches
chapter1::cpp20 Namespace Reference

Solutions for Chapter 1 (C++20). More...

Functions

constexpr uint32_t binary_func (uint64_t const N)
 A runtime binary to decimal number translation.
 
consteval uint32_t binary (uint64_t const N)
 Prepend higher bits to lowest bit.
 

Detailed Description

Solutions for Chapter 1 (C++20).

Function Documentation

◆ binary()

consteval uint32_t chapter1::cpp20::binary ( uint64_t const  N)

Prepend higher bits to lowest bit.

Parameters
[in]NA binary number to examine. Obvisouly, this should contain only 0 and 1.
Returns
A decimal representation of the given binary number.

Definition at line 38 of file c++20/chapter-1.cpp.

◆ binary_func()

constexpr uint32_t chapter1::cpp20::binary_func ( uint64_t const  N)
constexpr

A runtime binary to decimal number translation.

Parameters
[in]NA binary number to examine. Obvisouly, this should contain only 0 and 1.
Returns
A decimal representation of the given binary number.

Definition at line 26 of file c++20/chapter-1.cpp.