4 ms·
Seems like the meta-language (compile-time expressions) is now pretty much full fledged. Long gone days where template meta-programming was the only way to do
by 75dvtwin 9y ago
Seems like the meta-language (compile-time expressions) is now pretty much full fledged.
Long gone days where template meta-programming was the only way to do compile-time code generation and constant checks.... at least that's my impression of the latest language-level features.
I have not worked professionally with c++ for a few years now, but his piece from the article, just seems rather powerful incarnation of the compile-time programming.
constexpr auto add = [] (int x, int y) {
auto L = [=] { return x; };
auto R = [=] { return y; };
return [=] { return L() + R(); };
};
- wtarreau 9y agoBah what an horror. I doubt anyone can spot a more unreadable language (except maybe brainfuck). One of the issues I have with C++ is that they seem to have used basically all the symbols you can find on a keyboard to create unspellable operators or modifiers, and since they didn't have enough to avoid colliding with C, they mixed them to create even more unreadable combinations. The other examples in the doc are good readings as well suggesting I never approach this "modern art".
- m-ou-se 9y ago> basically all the symbols you can find on a keyboard C++ doesn't even use @ and $, yet ;)
- krylon 9y agoI think the reason is that adding new keywords to the language always means the risk of breaking somebody's code. I can see why a standardization body would want to avoid that, even though I agree wholeheartedly the result is not pretty.
- andrewjw 9y agoCan you explain what your code example would be used for (instead of just plus)?