User-Defined Literals, Part 3 -- Andrzej Krzemieński

Andrzej Krzemieński’s latest:

User-defined literals — Part III

In the previous post we have seen how we can define a raw literal operator template that enables us to convert almost any binary literal of the form 11011_b to a corresponding value of type unsigned int at compile time and still use this value as a compile-time constant. However, the length of the literal has to be short enough to fit into the capacity of type unsigned int.

In this post, as promised, we will try to make our literal render values of different types based on the length of the binary literal, so that 11011_b renders value of type unsigned int and 100010001000100010001000100010001000_b renders value of type long long unsigned int ...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.