Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's more of an issue with things like std::transform or std::copy_if. Ergonomically, it's nice if these kinds of functions either allocate and return a new container, or return an iterator that yields the elements of the result.

But the C++ versions of these take the result location as an argument. It makes chaining them together a hassle because you have to create all the intermediate containers explicitly.

I think there are good reasons for the STL to work this way, but it can make programming in a functional style pretty inconvenient compared to a lot of other languages.



Ranges will help with some of the composability issues of standard library algorithms.

[1] https://en.cppreference.com/w/cpp/ranges




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: