diff options
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__functional/identity.h')
-rw-r--r-- | contrib/llvm-project/libcxx/include/__functional/identity.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/contrib/llvm-project/libcxx/include/__functional/identity.h b/contrib/llvm-project/libcxx/include/__functional/identity.h index ee92c4130e71..7fbfc6c6249b 100644 --- a/contrib/llvm-project/libcxx/include/__functional/identity.h +++ b/contrib/llvm-project/libcxx/include/__functional/identity.h @@ -11,6 +11,7 @@ #define _LIBCPP___FUNCTIONAL_IDENTITY_H #include <__config> +#include <__functional/reference_wrapper.h> #include <__type_traits/integral_constant.h> #include <__utility/forward.h> @@ -34,21 +35,28 @@ struct __identity { template <> struct __is_identity<__identity> : true_type {}; +template <> +struct __is_identity<reference_wrapper<__identity> > : true_type {}; +template <> +struct __is_identity<reference_wrapper<const __identity> > : true_type {}; #if _LIBCPP_STD_VER >= 20 struct identity { - template<class _Tp> - _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept - { - return std::forward<_Tp>(__t); - } + template <class _Tp> + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept { + return std::forward<_Tp>(__t); + } - using is_transparent = void; + using is_transparent = void; }; template <> struct __is_identity<identity> : true_type {}; +template <> +struct __is_identity<reference_wrapper<identity> > : true_type {}; +template <> +struct __is_identity<reference_wrapper<const identity> > : true_type {}; #endif // _LIBCPP_STD_VER >= 20 |