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 | |
9 | namespace jitstd |
10 | { |
11 | template <typename Type1, typename Type2> |
12 | class pair |
13 | { |
14 | public: |
15 | Type1 first; |
16 | Type2 second; |
17 | |
18 | pair(const Type1& fst, const Type2& sec) |
19 | : first(fst) |
20 | , second(sec) |
21 | { |
22 | } |
23 | |
24 | template <typename AltType1, typename AltType2> |
25 | pair(const AltType1& fst, const AltType2& sec) |
26 | : first((Type1) fst) |
27 | , second((Type2) sec) |
28 | { |
29 | } |
30 | |
31 | template <typename AltType1, typename AltType2> |
32 | pair(const pair<AltType1, AltType2>& that) |
33 | : first((Type1) that.first) |
34 | , second((Type2) that.second) |
35 | { |
36 | } |
37 | |
38 | pair(const pair& that) |
39 | : first(that.first) |
40 | , second(that.second) |
41 | { |
42 | } |
43 | |
44 | template <typename AltType1, typename AltType2> |
45 | const pair<Type1, Type2>& operator=(const pair<AltType1, AltType2>& pair) |
46 | { |
47 | first = pair.first; |
48 | second = pair.second; |
49 | return *this; |
50 | } |
51 | |
52 | bool operator==(const pair<Type1, Type2>& other) const |
53 | { |
54 | return (other.first == first && other.second == second); |
55 | } |
56 | }; |
57 | } |
58 | |