Path: blob/main/contrib/llvm-project/libcxx/include/__cxx03/__functional/identity.h
213799 views
// -*- C++ -*-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-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___CXX03___FUNCTIONAL_IDENTITY_H10#define _LIBCPP___CXX03___FUNCTIONAL_IDENTITY_H1112#include <__cxx03/__config>13#include <__cxx03/__fwd/functional.h>14#include <__cxx03/__type_traits/integral_constant.h>15#include <__cxx03/__utility/forward.h>1617#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18# pragma GCC system_header19#endif2021_LIBCPP_BEGIN_NAMESPACE_STD2223template <class _Tp>24struct __is_identity : false_type {};2526struct __identity {27template <class _Tp>28_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _Tp&& operator()(_Tp&& __t) const _NOEXCEPT {29return std::forward<_Tp>(__t);30}3132using is_transparent = void;33};3435template <>36struct __is_identity<__identity> : true_type {};37template <>38struct __is_identity<reference_wrapper<__identity> > : true_type {};39template <>40struct __is_identity<reference_wrapper<const __identity> > : true_type {};4142_LIBCPP_END_NAMESPACE_STD4344#endif // _LIBCPP___CXX03___FUNCTIONAL_IDENTITY_H454647