#ifndef BINARY_INCLUDED # define BINARY_INCLUDED template struct binary { static_assert(FIRST == '0' || FIRST == '1', "invalid binary digit" ); enum { value = ((FIRST - '0') << sizeof...(REST)) + binary::value }; }; template<> struct binary<'0'> { enum { value = 0 }; }; template<> struct binary<'1'> { enum { value = 1 }; }; template inline constexpr unsigned int operator "" _b() { return binary::value; } #endif // BINARY_INCLUDED