Wed, 27 May 2015 21:44:42 +0300
Use raw mode instead of cbreak mode, otherwise ctrl+q doesn't appear to work right
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
73
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
2 | Copyright 2014, 2015 Teemu Piippo |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | All rights reserved. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | Redistribution and use in source and binary forms, with or without |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | modification, are permitted provided that the following conditions |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | are met: |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | 1. Redistributions of source code must retain the above copyright |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | notice, this list of conditions and the following disclaimer. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | 2. Redistributions in binary form must reproduce the above copyright |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | notice, this list of conditions and the following disclaimer in the |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | documentation and/or other materials provided with the distribution. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | 3. Neither the name of the copyright holder nor the names of its |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | contributors may be used to endorse or promote products derived from |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | this software without specific prior written permission. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | */ |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | #pragma once |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | #include <algorithm> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | #include <memory> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | // |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | // ------------------------------------------------------------------------------------------------- |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | // |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | template<typename T> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | class Range |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | T m_a; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | T m_b; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | T m_step; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | public: |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | struct Iterator |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | T value; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | T step; |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
51 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
52 | Iterator (T value, T step) : |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
53 | value (value), |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
54 | step (step) {} |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
55 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
56 | T& operator*() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
57 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
58 | return value; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
59 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
60 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
61 | bool operator== (const Iterator& other) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
62 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
63 | return value == other.value; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
64 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
65 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
66 | bool operator!= (const Iterator& other) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
67 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
68 | return value != other.value; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
69 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
70 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
71 | Iterator& operator++() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
72 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
73 | value += step; return *this; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
74 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | }; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
77 | Range (T a, T b, T step = 1) : |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
78 | m_a (a), |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
79 | m_b (b), |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
80 | m_step (step) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
81 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
82 | check_bounds(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
83 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
85 | Range() : |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
86 | m_a (T()), |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
87 | m_b (T()) {} |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
89 | Iterator begin() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
90 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
91 | Iterator it; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
92 | it.value = min(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
93 | it.step = m_step; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
94 | return it; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
95 | } |
5 | 96 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
97 | Iterator end() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
98 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
99 | Iterator it; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
100 | it.value = max() + 1; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
101 | it.step = m_step; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
102 | return it; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
103 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
105 | T min() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
106 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
107 | return m_a; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
108 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
110 | T max() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
111 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
112 | return m_b; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
113 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
115 | void check_bounds() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
116 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
117 | if (m_b < m_a) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
118 | std::swap (m_a, m_b); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
119 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
121 | bool contains (T c) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
122 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
123 | return c >= m_a |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
124 | and c <= m_b; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
125 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
127 | bool contains_exclusively (T c) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
128 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
129 | return c > m_a |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
130 | and c < m_b; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
131 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
133 | bool overlaps (Range<T> const& other) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
134 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
135 | return contains (other.m_a) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
136 | or contains (other.m_b); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
137 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
139 | bool operator== (Range<T> const& other) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
140 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
141 | return m_a == other.m_a |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
142 | and m_b == other.m_b; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
143 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
145 | bool operator!= (Range<T> const& other) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
146 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
147 | return not operator== (other); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
148 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
149 | }; |