[libcxx-commits] [libcxx] [libc++] Optimize char_traits a bit (PR #72799)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 20 10:25:37 PST 2023
================
@@ -35,18 +35,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// of elements as opposed to a number of bytes.
enum class __element_count : size_t {};
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t __constexpr_strlen(const char* __str) {
+template <class _Tp>
----------------
ldionne wrote:
I really don't like that we're accepting arbitrary integral types in `__constexpr_strlen`. IMO it doesn't make sense to use `strlen` on e.g. `int8_t` -- it only makes sense for character types. Instead, I'd be much happier if you checked explicitly for `char` and `char8_t`.
https://github.com/llvm/llvm-project/pull/72799
More information about the libcxx-commits
mailing list