[libcxx-commits] [PATCH] D153201: [libc++] Adds string_view constructor overload
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 7 16:43:34 PDT 2023
philnik added inline comments.
================
Comment at: libcxx/include/bitset:835
+#if _LIBCPP_STD_VER >= 26
+template <size_t _Size>
----------------
Given that we want to move away from defining member functions out-of-line, maybe we want to jut define the new functions inline directly?
================
Comment at: libcxx/include/bitset:844-858
+ if (__pos > __str.size())
+ __throw_out_of_range("bitset string pos out of range");
+
+ size_t __rlen = std::min(__n, __str.size() - __pos);
+ for (size_t __i = __pos; __i < __pos + __rlen; ++__i)
+ if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
+ __throw_invalid_argument("bitset string ctor has invalid argument");
----------------
I think a helper to deduplicate this code between the overloads above and below wold be a good idea. There is also some pretty obvious optimization opportunity missed by clang for this code, so maybe we can improve on it later.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153201/new/
https://reviews.llvm.org/D153201
More information about the libcxx-commits
mailing list