Today on the Codexpert blog:
User-defined literals
by Marius Bancila
From the article:
The C++11 standard introduced the possibility to create user-defined literals, that are basically built-in type literals (
integer
,float
,char
or string) followed by a used-defined suffix. User-defined literals enable the creation of new objects based on the built-in literal value and the applied user-defined suffix.auto temp = 77_fah; // 77 Fahrenheit degrees = 25 Celsius degrees auto size = 1_KB; // 1 kilobyte = 1024 bytes auto emp = "marius"_dev; // a user defined type Developer
Add a Comment
Comments are closed.