[MLIR][TOSA] Update CustomOp input and output names (#118408)
[llvm-project.git] / libcxx / include / __functional / identity.h
blob1b1c6cf73c3780c7f8744bac7a5f265ac95e5587
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___FUNCTIONAL_IDENTITY_H
11 #define _LIBCPP___FUNCTIONAL_IDENTITY_H
13 #include <__config>
14 #include <__fwd/functional.h>
15 #include <__type_traits/integral_constant.h>
16 #include <__utility/forward.h>
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 # pragma GCC system_header
20 #endif
22 _LIBCPP_BEGIN_NAMESPACE_STD
24 template <class _Tp>
25 struct __is_identity : false_type {};
27 struct __identity {
28 template <class _Tp>
29 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& operator()(_Tp&& __t) const _NOEXCEPT {
30 return std::forward<_Tp>(__t);
33 using is_transparent = void;
36 template <>
37 struct __is_identity<__identity> : true_type {};
38 template <>
39 struct __is_identity<reference_wrapper<__identity> > : true_type {};
40 template <>
41 struct __is_identity<reference_wrapper<const __identity> > : true_type {};
43 #if _LIBCPP_STD_VER >= 20
45 struct identity {
46 template <class _Tp>
47 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept {
48 return std::forward<_Tp>(__t);
51 using is_transparent = void;
54 template <>
55 struct __is_identity<identity> : true_type {};
56 template <>
57 struct __is_identity<reference_wrapper<identity> > : true_type {};
58 template <>
59 struct __is_identity<reference_wrapper<const identity> > : true_type {};
61 #endif // _LIBCPP_STD_VER >= 20
63 _LIBCPP_END_NAMESPACE_STD
65 #endif // _LIBCPP___FUNCTIONAL_IDENTITY_H