xref: /openbsd-src/gnu/llvm/compiler-rt/lib/orc/stl_extras.h (revision 810390e339a5425391477d5d41c78d7cab2424ac)
1d89ec533Spatrick //===-------- stl_extras.h - Useful STL related functions-------*- C++ -*-===//
2d89ec533Spatrick //
3d89ec533Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4d89ec533Spatrick // See https://llvm.org/LICENSE.txt for license information.
5d89ec533Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6d89ec533Spatrick //
7d89ec533Spatrick //===----------------------------------------------------------------------===//
8d89ec533Spatrick //
9d89ec533Spatrick // This file is a part of the ORC runtime support library.
10d89ec533Spatrick //
11d89ec533Spatrick //===----------------------------------------------------------------------===//
12d89ec533Spatrick 
13d89ec533Spatrick #ifndef ORC_RT_STL_EXTRAS_H
14d89ec533Spatrick #define ORC_RT_STL_EXTRAS_H
15d89ec533Spatrick 
16d89ec533Spatrick #include <utility>
17d89ec533Spatrick #include <tuple>
18d89ec533Spatrick 
19d89ec533Spatrick namespace __orc_rt {
20d89ec533Spatrick 
21*810390e3Srobert /// Substitute for std::identity.
22*810390e3Srobert /// Switch to std::identity once we can use c++20.
23*810390e3Srobert template <class Ty> struct identity {
24*810390e3Srobert   using is_transparent = void;
25*810390e3Srobert   using argument_type = Ty;
26d89ec533Spatrick 
operatoridentity27*810390e3Srobert   Ty &operator()(Ty &self) const { return self; }
operatoridentity28*810390e3Srobert   const Ty &operator()(const Ty &self) const { return self; }
29*810390e3Srobert };
30d89ec533Spatrick 
31d89ec533Spatrick } // namespace __orc_rt
32d89ec533Spatrick 
33d89ec533Spatrick #endif // ORC_RT_STL_EXTRAS
34