C++ Logo


Advanced search

Re: [std-proposals] Stop adding more member functions that shouldn't be added

From: blacktea hamburger <greenteahamburger_at_[hidden]>
Date: Sat, 22 Oct 2022 13:41:13 +0800
Well, you have a point. The member function syntax does seem a little nicer.
And, if those member functions are bad, the design is bad from the
beginning. So just keep adding member functions for consistency.

On Wed, Oct 19, 2022 at 6:18 AM Ville Voutilainen <
ville.voutilainen_at_[hidden]> wrote:

> 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.

Received on 2022-10-22 05:41:43