Date: Wed, 19 Oct 2022 01:17:56 +0300
On Sun, 16 Oct 2022 at 11:33, blacktea hamburger via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> http://www.gotw.ca/gotw/084.htm expounds that where possible, prefer writing functions as nonmember nonfriends. So many mistakes have been made in the standard library, but they are hard to correct. So now we can only stop making more mistakes like std::basic_string::contains, which I recommend removing.
std::basic_string::contains is not a mistake, and we ain't removing
it. It is a massive usability improvement,
because it's rather easy to get the argument order wrong in something
like std::contains(needle, haystack) // oops
but it's seriously difficult with haystack.contains(needle).
GotW is not gospel that you should follow blindly. In many places,
it's anything but, it's an opinion piece.
<std-proposals_at_[hidden]> wrote:
>
> http://www.gotw.ca/gotw/084.htm expounds that where possible, prefer writing functions as nonmember nonfriends. So many mistakes have been made in the standard library, but they are hard to correct. So now we can only stop making more mistakes like std::basic_string::contains, which I recommend removing.
std::basic_string::contains is not a mistake, and we ain't removing
it. It is a massive usability improvement,
because it's rather easy to get the argument order wrong in something
like std::contains(needle, haystack) // oops
but it's seriously difficult with haystack.contains(needle).
GotW is not gospel that you should follow blindly. In many places,
it's anything but, it's an opinion piece.
Received on 2022-10-18 22:18:09