This repository was archived by the owner on Jan 23, 2023. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathpair.h
57 lines (47 loc) · 1.23 KB
/
pair.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma once
namespacejitstd
{
template <typename Type1, typename Type2>
classpair
{
public:
Type1 first;
Type2 second;
pair(const Type1& fst, const Type2& sec)
: first(fst)
, second(sec)
{
}
template <typename AltType1, typename AltType2>
pair(const AltType1& fst, const AltType2& sec)
: first((Type1) fst)
, second((Type2) sec)
{
}
template <typename AltType1, typename AltType2>
pair(const pair<AltType1, AltType2>& that)
: first((Type1) that.first)
, second((Type2) that.second)
{
}
pair(const pair& that)
: first(that.first)
, second(that.second)
{
}
template <typename AltType1, typename AltType2>
const pair<Type1, Type2>& operator=(const pair<AltType1, AltType2>& pair)
{
first = pair.first;
second = pair.second;
return *this;
}
booloperator==(const pair<Type1, Type2>& other) const
{
return (other.first == first && other.second == second);
}
};
}