3 ms·
re: P1679, basic_string::contains, I had always assumed that C++ didn't have Java-like niceties in the standard string class because the C++ library philosophy
by twoodfin 6y ago
re: P1679, basic_string::contains,
I had always assumed that C++ didn't have Java-like niceties in the standard string class because the C++ library philosophy was to separate algorithms from containers. Doesn't it feel like a failure of the library evolution process that this particular convenience is still valuable enough to add in preference to whatever syntax already falls out of ranges::includes?
- blux 6y agoThis separation was never a hard requirement. For example `std::map` implements `lower_bound` and `upper_bound` as member functions because they can be implemented more efficiently than the general `std::lower_bound` and `std::upper_bound`, at least at the time. The paper itself discusses the member function vs. free function problem: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1679r3.html#42-member-function-vs-free-function http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p167...