xref: /freebsd/contrib/llvm-project/compiler-rt/lib/orc/stl_extras.h (revision 63f537551380d2dab29fa402ad1269feae17e594)
1 //===-------- stl_extras.h - Useful STL related functions-------*- C++ -*-===//
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 // This file is a part of the ORC runtime support library.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef ORC_RT_STL_EXTRAS_H
14 #define ORC_RT_STL_EXTRAS_H
15 
16 #include <utility>
17 #include <tuple>
18 
19 namespace __orc_rt {
20 
21 /// Substitute for std::identity.
22 /// Switch to std::identity once we can use c++20.
23 template <class Ty> struct identity {
24   using is_transparent = void;
25   using argument_type = Ty;
26 
27   Ty &operator()(Ty &self) const { return self; }
28   const Ty &operator()(const Ty &self) const { return self; }
29 };
30 
31 } // namespace __orc_rt
32 
33 #endif // ORC_RT_STL_EXTRAS
34