Learn more about litterals.
Modern C++ Features – User-Defined Literals
by Arne Mertz
From the article:
User-defined literals are a convenient feature added in C++11.
C++ always had a number of built-in ways to write literals: Pieces of source code that have a specific type and value. They are part of the basic building blocks of the language:
32 043 0x34 //integer literals, type int 4.27 5E1 //floating point literals, type double 'f', '\n' //character literals, type char "foo" //string literal, type const char[4] true, false //boolean literals, type boolThese are only the most common ones, there are many more, including some newcomers in the newer standards. Other literals are nullptr and different kinds of prefixes for character and string literals. There also are suffixes we can use to change the type of a built-in numeric literal:
32u //unsigned int 043l //long 0x34ull //unsigned long long 4.27f //float 5E1l //long double
Add a Comment
Comments are closed.