constant_literals

constant_literals provide the most convenient way possible in the current C++ to create objects of ac::constant, for example, 42_c.

Reference

Similarly to the standard namespaces with literals, namespace constant_literals is an inline namespace within namespace ac. Access to its content can be gained with using namespace ac::constant_literals.

namespace constant_literals

Functions

template<char... Chars>
auto operator""_c() noexcept

Literal that produces ac::constant of type int.

template<char... Chars>
auto operator""_cu() noexcept

Literal that produces ac::constant of type unsigned.

template<char... Chars>
auto operator""_cll() noexcept

Literal that produces ac::constant of type long long.

template<char... Chars>
auto operator""_cull() noexcept

Literal that produces ac::constant of type unsigned long long.

Source code

Tests

Design

See the following article for the approach explanation, in particular why it has to be so complicated.