C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches
exercise_3_0::checked_binary< N > Struct Template Reference

Compile-time binary to decimal number translation. More...

#include <exercise-3-0.hpp>

Public Member Functions

 BOOST_STATIC_ASSERT (((N % 10)< 2))
 

Static Public Attributes

static unsigned const value
 

Detailed Description

template<unsigned long N>
struct exercise_3_0::checked_binary< N >

Compile-time binary to decimal number translation.

Template Parameters
NA binary number to examine. Obvisouly, this should contain only 0 and 1.

Definition at line 37 of file exercise-3-0.hpp.

Member Function Documentation

◆ BOOST_STATIC_ASSERT()

template<unsigned long N>
exercise_3_0::checked_binary< N >::BOOST_STATIC_ASSERT ( ((N % 10)< 2)  )

Member Data Documentation

◆ value

template<unsigned long N>
unsigned const exercise_3_0::checked_binary< N >::value
static
Initial value:
=
(checked_binary<N/10>::value * 2) + (N % 10)
consteval uint32_t checked_binary(uint64_t const N)
Prepend higher bits to lowest bit.
static unsigned const value

Definition at line 41 of file exercise-3-0.hpp.


The documentation for this struct was generated from the following file: