3 ms·
Well, I'm not completely disagreeing with you, but by experience, less line of code often translates in simpler to understand code in C++ if the removed code is
by gpderetta 6y ago
Well, I'm not completely disagreeing with you, but by experience, less line of code often translates in simpler to understand code in C++ if the removed code is just boilerplate (i.e. you are not just golfing).
Concepts do help with the return type issue, at least now you can declare that your inferred return type conforms to some interface; for example:
auto iterator take_n(auto range&& r, size_t n) {...}
take_n is very generic and can return any type. But at least with concepts you can declare that it will look like an iterator. (in practice the result type depends on the range type and take_n declaration will show that).
One problem with C++ is that the barrier for adding stuff to the standard library is much lower than adding it to the language. So for example we got std::bind well before we got lambdas; same thing will happen with variants (already in the library), proper union types and patter matching (there are proposals to add both the language).