C++ Language/Type/Literals/CustomLiterals

From Wikibooks, open books for an open world
Jump to navigation Jump to search

You can now define your own custom syntax for literals of the form prefix_suffix. After programming int operator"" _meter(), you can use 123_meter in any situation where you used to program with an ordinary numeral.

Additional information about custom literals (includes interactive examples)