|
|
|
|
|
by einpoklum
11 days ago
|
|
C++ is quite amenable to making things less verbose. For example: Instead of a standard library algorithm taking a pair of iterators, you could have a function taking a container and calling the other function with its start() and end(). And then, with newer versions of the language, you can use a ranges-based function. There are lots of such syntactic hacks, from `using` through typed literals all the way to preprocessor macros (which we want to avoid, but are still there). That's how you emulate language features that aren't there originally. I've "impelemented" a static code block, like in Java: https://stackoverflow.com/a/34321324/1593077 and that's all in C++98. The implementation is a bit ugly but the use is terse and self-expalantory. |
|