public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9303] libstdc++: Simplify constraints for std::any construction
@ 2021-11-24 11:52 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-11-24 11:52 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:853b9d54365372e0926746ff939004389a8742aa

commit r11-9303-g853b9d54365372e0926746ff939004389a8742aa
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Oct 4 23:14:30 2021 +0100

    libstdc++: Simplify constraints for std::any construction
    
    libstdc++-v3/ChangeLog:
    
            * include/std/utility (__is_in_place_type_v): Define
            variable template to detect in_place_type_t specializations.
            (__is_in_place_type): Replace class template with alias
            template using __is_in_place_type_v.
            * include/std/any (any(T&&)): Check __is_in_place_type first and
            avoid instantiating is_copy_constructible unnecessarily.
    
    (cherry picked from commit 6da36b7d0e43b6f9281c65c19a025d4888a25b2d)

Diff:
---
 libstdc++-v3/include/std/any     |  4 ++--
 libstdc++-v3/include/std/utility | 10 +++-------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index aae2b731d42..d96ea06c1ae 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -184,8 +184,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     /// Construct with a copy of @p __value as the contained object.
     template <typename _Tp, typename _VTp = _Decay_if_not_any<_Tp>,
 	      typename _Mgr = _Manager<_VTp>,
-	      enable_if_t<is_copy_constructible<_VTp>::value
-			  && !__is_in_place_type<_VTp>::value, bool> = true>
+	      typename = _Require<__not_<__is_in_place_type<_VTp>>,
+				  is_copy_constructible<_VTp>>>
       any(_Tp&& __value)
       : _M_manager(&_Mgr::_S_manage)
       {
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 3e68f682e00..f54f75b4d38 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -372,17 +372,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     inline constexpr in_place_index_t<_Idx> in_place_index{};
 
   template<typename>
-    struct __is_in_place_type_impl : false_type
-    { };
+    inline constexpr bool __is_in_place_type_v = false;
 
   template<typename _Tp>
-    struct __is_in_place_type_impl<in_place_type_t<_Tp>> : true_type
-    { };
+    inline constexpr bool __is_in_place_type_v<in_place_type_t<_Tp>> = true;
 
   template<typename _Tp>
-    struct __is_in_place_type
-      : public __is_in_place_type_impl<_Tp>
-    { };
+    using __is_in_place_type = bool_constant<__is_in_place_type_v<_Tp>>;
 
 #define  __cpp_lib_as_const 201510
   template<typename _Tp>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-24 11:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 11:52 [gcc r11-9303] libstdc++: Simplify constraints for std::any construction Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).