Analog literals Analog literals are a cute C++ gadget proposed by Eelis in the seminal article [Multi-Dimensional Analog Literals]. That forward-thinking monument to human mischief finally allowed C++ developers to represent lines, squares and cuboids directly in code: using namespace analog_literals::symbols; assert( ( o-------------o |L \ | L \ | L \ | o-------------o | ! ! ! ! ! o | ! L | ! L | ! L| ! o-------------o ).volume == ( o-------------o | ! ! ! ! ! o-------------o ).area * int(I-------------I) ); Paving the way for a more expressive future is no easy task. Pioneers might open grand doors and bless the world with such diruptive breakthroughs, though polishing those new tools until they become what is they always ought to be is the work of a thousand hands. Indeed the original analog literals weren’t free of issues. Take for example the way lines are calculated: assert( I-I == 0 ); assert( I---I == 1 ); assert( I-----I == 2 ); assert( I-------I == 3 ); Due to the max munch…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.