[libcxx-commits] [PATCH] D144568: [libc++][NFC] Refactor the __enable_ifs in <string>

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 16 08:27:58 PDT 2023


ldionne accepted this revision.
ldionne added a comment.
Herald added a subscriber: mikhail.ramalho.

I am fine with this since:

1. It increases consistency with the way we use `enable_if` elsewhere, and
2. the duplication is going away once we implement those member functions in the class, which we should do anyway.



================
Comment at: libcxx/include/string:2045
 template <class _CharT, class _Traits, class _Allocator>
-template <class>
+template <__enable_if_t<__is_allocator<_Allocator>::value, int> >
 _LIBCPP_CONSTEXPR_SINCE_CXX20
----------------
There's a bit of duplication here, which is kind of annoying. However, refactoring this short function to be defined in-class will remove that duplication, and also remove some boilerplate which is not really useful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144568



More information about the libcxx-commits mailing list