[libcxx-commits] [PATCH] D128081: [libc++] Inline the string constructors

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 21 15:35:56 PDT 2022

philnik added a comment.

> And what happens if we accidentally change the return type of the function because we changed the function body, like returning something convertible to the iterator type rather than the iterator?

I wasn't talking about function return types. I had more something in mind where you have to `auto it = first;`, where it's obviously clear what the type is. I think you might be correct that we shouldn't use `auto` as a return type on standard-mandated functions, but I think that's debatable. Anyways, this patch isn't changing any return types to auto, to there is no point in discussing it here further.

> Further, I don't think moving the function bodies does anything other than make the class declaration less readable. Which is bad because ideally we should be able to visually inspect the class declaration to see if it matches the standard (std::string is a long way off from that ATM, but that's not license to make it worse).

We obviously disagree here. I see no reason to have `template <class _CharT, class _Traits, class _Allocator>` hundreds of times, `_LIBCPP_CONSTEXPR_AFTER_CXX17` two times as often as needed or `basic_string<_CharT, _Traits, _Allocator>` instead of `basic_string` in the file without any real use.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list