From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Simplify constraints for std::any construction
Date: Tue, 5 Oct 2021 15:58:01 +0100 [thread overview]
Message-ID: <YVxn+QG4OV4lPi43@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
libstdc++-v3/ChangeLog:
* include/bits/utility.h (__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.
Tested powerpc64le-linux. Committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2207 bytes --]
commit 6da36b7d0e43b6f9281c65c19a025d4888a25b2d
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Oct 4 23:14:30 2021
libstdc++: Simplify constraints for std::any construction
libstdc++-v3/ChangeLog:
* include/bits/utility.h (__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.
diff --git a/libstdc++-v3/include/bits/utility.h b/libstdc++-v3/include/bits/utility.h
index 96d350874d9..fce52a4530d 100644
--- a/libstdc++-v3/include/bits/utility.h
+++ b/libstdc++-v3/include/bits/utility.h
@@ -184,17 +184,14 @@ _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>>;
+
#endif // C++17
#endif // C++14
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index 625cac619f0..e3d9d774de4 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -183,8 +183,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)
{
reply other threads:[~2021-10-05 14:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YVxn+QG4OV4lPi43@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).