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

Solutions for Chapter 1. More...

Namespaces

namespace  cpp20
 Solutions for Chapter 1 (C++20).
 

Classes

struct  binary
 Prepend higher bits to lowest bit. More...
 
struct  binary< 0 >
 Recursion termination. 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.
 
unsigned binary_func (unsigned long const N)
 A runtime binary to decimal number translation.
 

Detailed Description

Solutions for Chapter 1.

Function Documentation

◆ binary_func() [1/2]

unsigned chapter1::binary_func ( unsigned long const  N)

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 35 of file chapter-1.cpp.