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___TYPE_TRAITS_IS_REFERENCE_H 10#define _LIBCPP___TYPE_TRAITS_IS_REFERENCE_H 11 12#include <__config> 13#include <__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#if __has_builtin(__is_lvalue_reference) && \ 22 __has_builtin(__is_rvalue_reference) && \ 23 __has_builtin(__is_reference) 24 25template<class _Tp> 26struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { }; 27 28template<class _Tp> 29struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> { }; 30 31template<class _Tp> 32struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { }; 33 34#if _LIBCPP_STD_VER > 14 35template <class _Tp> 36inline constexpr bool is_reference_v = __is_reference(_Tp); 37template <class _Tp> 38inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); 39template <class _Tp> 40inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); 41#endif 42 43#else // __has_builtin(__is_lvalue_reference) && etc... 44 45template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {}; 46template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {}; 47 48template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {}; 49template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {}; 50 51template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {}; 52template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; 53template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; 54 55#if _LIBCPP_STD_VER > 14 56template <class _Tp> 57inline constexpr bool is_reference_v = is_reference<_Tp>::value; 58 59template <class _Tp> 60inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value; 61 62template <class _Tp> 63inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value; 64#endif 65 66#endif // __has_builtin(__is_lvalue_reference) && etc... 67 68_LIBCPP_END_NAMESPACE_STD 69 70#endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCE_H 71