1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef _LIBCPP___CXX03___TYPE_TRAITS_IS_SAME_H 10 #define _LIBCPP___CXX03___TYPE_TRAITS_IS_SAME_H 11 12 #include <__cxx03/__config> 13 #include <__cxx03/__type_traits/integral_constant.h> 14 15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 16 # pragma GCC system_header 17 #endif 18 19 _LIBCPP_BEGIN_NAMESPACE_STD 20 21 template <class _Tp, class _Up> 22 struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> {}; 23 24 // _IsSame<T,U> has the same effect as is_same<T,U> but instantiates fewer types: 25 // is_same<A,B> and is_same<C,D> are guaranteed to be different types, but 26 // _IsSame<A,B> and _IsSame<C,D> are the same type (namely, false_type). 27 // Neither GCC nor Clang can mangle the __is_same builtin, so _IsSame 28 // mustn't be directly used anywhere that contributes to name-mangling 29 // (such as in a dependent return type). 30 31 template <class _Tp, class _Up> 32 using _IsSame = _BoolConstant<__is_same(_Tp, _Up)>; 33 34 template <class _Tp, class _Up> 35 using _IsNotSame = _BoolConstant<!__is_same(_Tp, _Up)>; 36 37 _LIBCPP_END_NAMESPACE_STD 38 39 #endif // _LIBCPP___CXX03___TYPE_TRAITS_IS_SAME_H 40