May 2017
Intermediate to advanced
590 pages
17h 18m
English
Use constexpr if statements to do the following:
template <typename T> auto compute(T const a, T const b) { if constexpr (std::is_integral<T>::value) return a * b; else return a + b; }
namespace binary { using byte8 = unsigned char; namespace binary_literals { namespace binary_literals_internals { template <typename CharT, char d, char... bits> constexpr CharT binary_eval() { if constexpr(sizeof...(bits) == 0) return static_cast<CharT>(d-'0'); else if constexpr(d == '0') Read now
Unlock full access