|
|
|||
File indexing completed on 2026-05-10 08:43:05
0001 //===- llvm/ADT/Identity.h - Provide std::identity from C++20 ---*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file provides an implementation of std::identity from C++20. 0010 // 0011 // No library is required when using these functions. 0012 // 0013 //===----------------------------------------------------------------------===// 0014 0015 #ifndef LLVM_ADT_IDENTITY_H 0016 #define LLVM_ADT_IDENTITY_H 0017 0018 0019 namespace llvm { 0020 0021 // Similar to `std::identity` from C++20. 0022 template <class Ty> struct identity { 0023 using is_transparent = void; 0024 using argument_type = Ty; 0025 0026 Ty &operator()(Ty &self) const { 0027 return self; 0028 } 0029 const Ty &operator()(const Ty &self) const { 0030 return self; 0031 } 0032 }; 0033 0034 } // end namespace llvm 0035 0036 #endif // LLVM_ADT_IDENTITY_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|