[libcxx-commits] [PATCH] D126663: [libc++][test] Refactor SmallBasicString uses in range.lazy.split tests

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 30 09:27:37 PDT 2022


jloser added inline comments.


================
Comment at: libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.range.pass.cpp:75
 
-struct StrRange {
-  SmallString buffer_;
-  constexpr explicit StrRange() = default;
-  constexpr StrRange(const char* ptr) : buffer_(ptr) {}
-  constexpr const char* begin() const { return buffer_.begin(); }
-  constexpr const char* end() const { return buffer_.end(); }
-  constexpr bool operator==(const StrRange& rhs) const { return buffer_ == rhs.buffer_; }
-};
+using StrRange = std::string;
 static_assert( std::ranges::random_access_range<StrRange>);
----------------
philnik wrote:
> I think it makes more sense to replace the occurrences of `StrRange` with `std::string`. Ditto for `string_view`.
I'm OK with that. I was debating whether to even touch this at all in this patch (I could have added a `base()` to the end of `begin()` and `end()` functions like I did elsewhere in this patch). Do you have a preference, @var-const?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126663/new/

https://reviews.llvm.org/D126663



More information about the libcxx-commits mailing list