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 14 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 15 # pragma GCC system_header 16 #endif 17 18 _LIBCPP_BEGIN_NAMESPACE_STD 19 20 template <class _Tp> 21 struct __unwrap_reference { typedef _LIBCPP_NODEBUG _Tp type; }; 22 23 template <class _Tp> 24 class reference_wrapper; 25 26 template <class _Tp> 27 struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG _Tp& type; }; 28 29 template <class _Tp> 30 struct decay; 31 32 #if _LIBCPP_STD_VER > 17 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<typename decay<_Tp>::type> { }; 41 42 template <class _Tp> 43 using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; 44 #endif // > C++17 45 46 template <class _Tp> 47 struct __unwrap_ref_decay 48 #if _LIBCPP_STD_VER > 17 49 : unwrap_ref_decay<_Tp> 50 #else 51 : __unwrap_reference<typename decay<_Tp>::type> 52 #endif 53 { }; 54 55 _LIBCPP_END_NAMESPACE_STD 56 57 #endif // _LIBCPP___FUNCTIONAL_UNWRAP_REF_H 58