1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5
6
7#pragma once
8
9namespace jitstd
10{
11
12template <typename T>
13void swap(T& a, T& b)
14{
15 T t(a);
16 a = b;
17 b = t;
18}
19
20template <typename Arg, typename Result>
21struct unary_function
22{
23 typedef Arg argument_type;
24 typedef Result result_type;
25};
26
27template <typename Arg1, typename Arg2, typename Result>
28struct binary_function
29{
30 typedef Arg1 first_argument_type;
31 typedef Arg2 second_argument_type;
32 typedef Result result_type;
33};
34
35template <typename T>
36struct greater : binary_function<T, T, bool>
37{
38 bool operator()(const T& lhs, const T& rhs) const
39 {
40 return lhs > rhs;
41 }
42};
43
44template <typename T>
45struct equal_to : binary_function<T, T, bool>
46{
47 bool operator()(const T& lhs, const T& rhs) const
48 {
49 return lhs == rhs;
50 }
51};
52
53template <typename T>
54struct identity : unary_function<T, T>
55{
56 const T& operator()(const T& op) const
57 {
58 return op;
59 }
60};
61
62} // end of namespace jitstd.
63