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_UNWRAP_REF_H 10 #define _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H 11 12 #include <__config> 13 #include <__fwd/functional.h> 14 #include <__type_traits/decay.h> 15 16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 17 # pragma GCC system_header 18 #endif 19 20 _LIBCPP_BEGIN_NAMESPACE_STD 21 22 template <class _Tp> 23 struct __unwrap_reference { 24 typedef _LIBCPP_NODEBUG _Tp type; 25 }; 26 27 template <class _Tp> 28 struct __unwrap_reference<reference_wrapper<_Tp> > { 29 typedef _LIBCPP_NODEBUG _Tp& type; 30 }; 31 32 #if _LIBCPP_STD_VER >= 20 33 template <class _Tp> 34 struct unwrap_reference : __unwrap_reference<_Tp> {}; 35 36 template <class _Tp> 37 using unwrap_reference_t = typename unwrap_reference<_Tp>::type; 38 39 template <class _Tp> 40 struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > {}; 41 42 template <class _Tp> 43 using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; 44 #endif // _LIBCPP_STD_VER >= 20 45 46 template <class _Tp> 47 struct __unwrap_ref_decay 48 #if _LIBCPP_STD_VER >= 20 49 : unwrap_ref_decay<_Tp> 50 #else 51 : __unwrap_reference<__decay_t<_Tp> > 52 #endif 53 { 54 }; 55 56 _LIBCPP_END_NAMESPACE_STD 57 58 #endif // _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H 59