[PATCH] D48616: Implement LWG 2946, 3075 and 3076

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 27 13:37:38 PDT 2018


mclow.lists marked 5 inline comments as done.
mclow.lists added inline comments.


================
Comment at: include/memory:5647
+       typename __void_t<typename _Alloc::value_type>::type,
+       typename __void_t<decltype(_VSTD::declval<_Alloc&>().allocate(size_t(0)))>::type
+     >
----------------
ldionne wrote:
> Sorry -- still not very fluent with how things are done in libc++, but don't we need to guard this based on C++11 at the very least because it's using `decltype`?
libc++ has an emulation of `decltype` for C++03, based on `typeof`. It's not perfect, but it works in a lot of cases.



================
Comment at: include/string:842
+        explicit basic_string(const _Tp& __t,
+                     typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0);
+
----------------
ldionne wrote:
> mclow.lists wrote:
> > ldionne wrote:
> > > Is there a reason why you use a different `enable_if` pattern here (as a default argument) and above (as a default template argument)?
> > One for constructors, one for non-constructors.
> > https://stackoverflow.com/questions/17842478/select-class-constructor-using-enable-if
> Even after reading the SO question, I think the following would work as well?
> 
> ```
> template<class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type>
> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
> explicit basic_string(const _Tp& __t);
> ```
> 
> Again, I'm not suggesting any change, just trying to understand,
I tried this locally, and it seems to work. Updated patch incoming.


https://reviews.llvm.org/D48616





More information about the cfe-commits mailing list