[PATCH] D26896: [libcxx] Make constexpr char_traits<T> and char_traits<char>

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 23 01:47:15 PST 2016


EricWF added inline comments.


================
Comment at: include/__string:213
 
-    static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
-        {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);}
-    static inline size_t length(const char_type* __s)  _NOEXCEPT {return strlen(__s);}
-    static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
-        {return __n == 0 ? NULL : (const char_type*) memchr(__s, to_int_type(__a), __n);}
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+    static inline constexpr int
----------------
wow. This is #ifdef hell. Please find a way to do it with less (or hopefully no) conditional compilation blocks.


https://reviews.llvm.org/D26896





More information about the cfe-commits mailing list