summaryrefslogtreecommitdiff
path: root/src/jit/jitstd/pair.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/jit/jitstd/pair.h')
-rw-r--r--src/jit/jitstd/pair.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/jit/jitstd/pair.h b/src/jit/jitstd/pair.h
new file mode 100644
index 0000000000..10ded3d147
--- /dev/null
+++ b/src/jit/jitstd/pair.h
@@ -0,0 +1,58 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+
+
+#pragma once
+
+namespace jitstd
+{
+template <typename Type1, typename Type2>
+class pair
+{
+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;
+ }
+
+ bool operator==(const pair<Type1, Type2>& other) const
+ {
+ return (other.first == first && other.second == second);
+ }
+};
+}