ScummVM API documentation
utility.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AGS_STD_UTILITY_H
23 #define AGS_STD_UTILITY_H
24 
25 #include "common/textconsole.h"
26 
27 namespace AGS3 {
28 namespace std {
29 
30 template<class T1, class T2>
31 struct pair {
32  T1 first;
33  T2 second;
34 
35  pair() {
36  }
37  pair(T1 first_, T2 second_) : first(first_), second(second_) {
38  }
39 };
40 
41 template< class T1, class T2 >
42 pair<T1, T2> make_pair(T1 first, T2 second) {
43  return pair<T1, T2>(first, second);
44 }
45 
46 // STRUCT TEMPLATE remove_reference
47 template <class _Ty>
49  typedef _Ty type;
50 };
51 
52 template<class _Ty>
53 struct remove_reference<_Ty &> {
54  typedef _Ty type;
55 };
56 
57 template<class _Ty>
58 struct remove_reference<_Ty &&> {
59  typedef _Ty type;
60 };
61 
62 template <class _Ty>
63 using remove_reference_t = typename remove_reference<_Ty>::type;
64 
65 // FUNCTION TEMPLATE move
66 // TODO: Haven't been able to get this to properly work to reset
67 // the source when moving the contents of std::vector arrays
68 template <class _Ty>
69 constexpr remove_reference_t<_Ty> &&move(_Ty &&_Arg) noexcept {
70  return static_cast<remove_reference_t<_Ty> &&>(_Arg);
71 }
72 
73 } // namespace std
74 } // namespace AGS3
75 
76 #endif
Definition: utility.h:31
constexpr remove_reference_t< T > && move(T &&t) noexcept
Definition: util.h:209
Definition: utility.h:48
Definition: ags.h:40