summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-10-11 16:53:44 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-10-11 16:53:44 +0100
commit02f6fdff65671ccfaf2f79092ccdfccdef1bcebf (patch)
tree508378686454dfbed782d893175443b4b2a061cb /libstdc++-v3/include
parent07758d90c7bc6b80b10a83bac52f9ab9e394131d (diff)
downloadgcc-02f6fdff65671ccfaf2f79092ccdfccdef1bcebf.tar.gz
Use __is_same_as for std::is_same and std::is_same_v
By using the built-in we don't need to match a partial specialization for std::is_same and don't need to instantiate std::is_same at all for uses of std::is_same_v. * include/std/type_traits (is_same): Replace partial specialization by using __is_same_as built-in in primary template. (is_same_v): Use __is_same_as built-in instead of instantiating the is_same trait. From-SVN: r276891
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/std/type_traits11
1 files changed, 4 insertions, 7 deletions
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index dc8a019324d..4de5daa9f06 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1388,13 +1388,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Type relations.
/// is_same
- template<typename, typename>
+ template<typename _Tp, typename _Up>
struct is_same
- : public false_type { };
-
- template<typename _Tp>
- struct is_same<_Tp, _Tp>
- : public true_type { };
+ : public integral_constant<bool, __is_same_as(_Tp, _Up)>
+ { };
/// is_base_of
template<typename _Base, typename _Derived>
@@ -3158,7 +3155,7 @@ template <typename _Tp>
template <typename _Tp, unsigned _Idx = 0>
inline constexpr size_t extent_v = extent<_Tp, _Idx>::value;
template <typename _Tp, typename _Up>
- inline constexpr bool is_same_v = is_same<_Tp, _Up>::value;
+ inline constexpr bool is_same_v = __is_same_as(_Tp, _Up);
template <typename _Base, typename _Derived>
inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
template <typename _From, typename _To>