1 // {{{ MIT License
2 
3 // Copyright 2017 Roland Kaminski
4 
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to
7 // deal in the Software without restriction, including without limitation the
8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 // sell copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 // IN THE SOFTWARE.
22 
23 // }}}
24 
25 #ifndef __GRINGO_MINGW_H
26 #define __GRINGO_MINGW_H
27 
28 #include <iterator>
29 
30 // Note 1: harmless because I don't have any throwing move constructors
31 // Note 2: should be first include
32 
33 #undef _GLIBCXX_MAKE_MOVE_ITERATOR
34 #undef _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR
35 
36 #define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter)
37 #define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) std::make_move_iterator(_Iter)
38 
39 #ifdef MISSING_STD_TO_STRING
40 
41 #include <sstream>
42 
43 namespace std {
44 
to_string(int x)45 inline string to_string(int x) {
46     ostringstream ss;
47     ss << x;
48     return ss.str();
49 }
50 
to_string(unsigned x)51 inline string to_string(unsigned x) {
52     ostringstream ss;
53     ss << x;
54     return ss.str();
55 }
56 
to_string(long x)57 inline string to_string(long x) {
58     ostringstream ss;
59     ss << x;
60     return ss.str();
61 }
62 
to_string(unsigned long x)63 inline string to_string(unsigned long x) {
64     ostringstream ss;
65     ss << x;
66     return ss.str();
67 }
68 
to_string(long long x)69 inline string to_string(long long x) {
70     ostringstream ss;
71     ss << x;
72     return ss.str();
73 }
74 
to_string(unsigned long long x)75 inline string to_string(unsigned long long x) {
76     ostringstream ss;
77     ss << x;
78     return ss.str();
79 }
80 
81 } // namespace std
82 
83 #endif // MISSING_STD_TO_STRING
84 
85 #endif // __GRINGO_MINGW_H
86