File tree Expand file tree Collapse file tree 1 file changed +11
-19
lines changed Expand file tree Collapse file tree 1 file changed +11
-19
lines changed Original file line number Diff line number Diff line change 3
3
* Copyright (c) 2009-2010, Martin Rosekeit
4
4
* Copyright (c) 2009-2011, Fabian Greif
5
5
* Copyright (c) 2012, Niklas Hauser
6
+ * Copyright (c) 2023, Christopher Durand
6
7
*
7
8
* This file is part of the modm project.
8
9
*
15
16
#ifndef MODM_PAIR_HPP
16
17
#define MODM_PAIR_HPP
17
18
19
+ #include < utility>
20
+
18
21
namespace modm
19
22
{
20
23
/* *
@@ -63,49 +66,38 @@ namespace modm
63
66
* \ingroup modm_container
64
67
*/
65
68
template <typename T1, typename T2>
66
- class Pair
69
+ class Pair : public std ::pair<T1, T2>
67
70
{
68
71
public:
69
- typedef T1 FirstType;
70
- typedef T2 SecondType;
72
+ using FirstType = T1 ;
73
+ using SecondType = T2 ;
71
74
72
75
public:
73
- // No non-trivial constructor is allowed, otherwise this class
74
- // won't be POD (plain old data) :-(
75
- // (this behavior changes with C++0x)
76
- /* Pair(const FirstType& first, const SecondType& second) :
77
- first(first), second(second)
78
- {
79
- }*/
76
+ using std::pair<T1, T2>::pair;
80
77
81
78
FirstType&
82
79
getFirst ()
83
80
{
84
- return first;
81
+ return this -> first ;
85
82
}
86
83
87
84
const FirstType&
88
85
getFirst () const
89
86
{
90
- return first;
87
+ return this -> first ;
91
88
}
92
89
93
90
SecondType&
94
91
getSecond ()
95
92
{
96
- return second;
93
+ return this -> second ;
97
94
}
98
95
99
96
const SecondType&
100
97
getSecond () const
101
98
{
102
- return second;
99
+ return this -> second ;
103
100
}
104
-
105
- // ... not allowed either, only public attributes :-(
106
- // private:
107
- FirstType first;
108
- SecondType second;
109
101
};
110
102
}
111
103
You can’t perform that action at this time.
0 commit comments