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___FUNCTIONAL_UNWRAP_REF_H 10 #define _LIBCPP___FUNCTIONAL_UNWRAP_REF_H 11 12 #include <__config> 13 #include <__type_traits/decay.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> 22 struct __unwrap_reference { typedef _LIBCPP_NODEBUG _Tp type; }; 23 24 template <class _Tp> 25 class reference_wrapper; 26 27 template <class _Tp> 28 struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG _Tp& type; }; 29 30 template <class _Tp> 31 struct decay; 32 33 #if _LIBCPP_STD_VER > 17 34 template <class _Tp> 35 struct unwrap_reference : __unwrap_reference<_Tp> { }; 36 37 template <class _Tp> 38 using unwrap_reference_t = typename unwrap_reference<_Tp>::type; 39 40 template <class _Tp> 41 struct unwrap_ref_decay : unwrap_reference<typename decay<_Tp>::type> { }; 42 43 template <class _Tp> 44 using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; 45 #endif // > C++17 46 47 template <class _Tp> 48 struct __unwrap_ref_decay 49 #if _LIBCPP_STD_VER > 17 50 : unwrap_ref_decay<_Tp> 51 #else 52 : __unwrap_reference<typename decay<_Tp>::type> 53 #endif 54 { }; 55 56 _LIBCPP_END_NAMESPACE_STD 57 58 #endif // _LIBCPP___FUNCTIONAL_UNWRAP_REF_H 59