[libcxx-commits] [PATCH] D58019: Add is_nothrow_convertible (P0758R1)

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 13 12:38:37 PST 2019


zoecarver marked 7 inline comments as done.
zoecarver added a comment.

Thanks for all the help :)



================
Comment at: include/type_traits:1564
+    template<typename __Fm, typename __To>
+    static bool_constant<noexcept(__test_noexcept<__To>(declval<__Fm>()))>
+    __test(int);
----------------
ldionne wrote:
> You can hoist this helper function and its friend above outside of the class. This way you don't get an instantiation of `__test_noexcept<_Tp>` for each pair of `_To` and `_From`, only one for each type. You'll still get an instantiation of `__test` for each pair of `_To` and `_From`, but at least you don't need to play games with the names of the template parameters if you hoist the function outside the class.
Good idea. I also simply inherit from `decltype` instead of having the `type` member. Much cleaner. 


================
Comment at: include/type_traits:1567
+    
+    template<typename, typename>
+    static false_type
----------------
ldionne wrote:
> I don't think you need this overload anymore. Indeed, you already know that `_Fm` is convertible to `_To` because you checked with `std::is_convertible`.
Your right. 


================
Comment at: test/std/type_traits/is_nothrow_convertible.pass.cpp:15
+
+#include "test_macros.h"
+
----------------
ldionne wrote:
> I think you don't need this header.
Correct. 


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

https://reviews.llvm.org/D58019





More information about the libcxx-commits mailing list