Wed, 27 Jan 2021 13:08:51 +0200
continue cleanup
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
109 | 2 | Copyright 2014 - 2016 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 "basics.h" |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | #include <algorithm> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | #include <deque> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | #include <functional> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | #include <cassert> |
87
53c2aecb9704
some work on MSVC support (still doesn't work yet...)
Teemu Piippo <tsapii@utu.fi>
parents:
73
diff
changeset
|
37 | #include <vector> |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | #include "range.h" |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
39 | BEGIN_ZFC_NAMESPACE |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | |
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 | // |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | template<typename T, typename C> |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | class Container |
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: |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
47 | typedef typename C::iterator Iterator; |
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
48 | typedef typename C::const_iterator ConstIterator; |
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
49 | typedef typename C::reverse_iterator ReverseIterator; |
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
50 | typedef typename C::const_reverse_iterator ConstReverseIterator; |
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
51 | typedef Container<T, C> Self; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
53 | Container(){} |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
54 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
55 | Container (int numvalues) : |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
56 | m_container (numvalues) {} |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
57 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
58 | Container (const C& other) : |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
59 | m_container (other) {} |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
60 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
61 | Container(std::initializer_list<T> initializerList) : |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
62 | m_container(initializerList) {} |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
63 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
64 | T& append (const T& value) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
65 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
66 | m_container.push_back (value); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
67 | return m_container[m_container.size() - 1]; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
68 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
69 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
70 | void append(const T* values, size_t numValues) |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
71 | { |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
72 | size_t i0 = size(); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
73 | resize(size() + numValues); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
74 | |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
75 | for (size_t i : range(numValues)) |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
76 | (*this)[i0 + i] = values[i]; |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
77 | } |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
78 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
79 | Iterator begin() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
80 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
81 | return m_container.begin(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
82 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
83 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
84 | ConstIterator begin() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
85 | { |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
86 | return m_container.begin(); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
87 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
88 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
89 | void clear() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
90 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
91 | m_container.clear(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
92 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
93 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
94 | bool contains (const T& a) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
95 | { |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
96 | return std::find (m_container.begin(), m_container.end(), a) != m_container.end(); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
97 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
98 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
99 | ConstReverseIterator crbegin() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
100 | { |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
101 | return m_container.rbegin(); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
102 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
103 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
104 | ConstReverseIterator crend() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
105 | { |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
106 | return m_container.rend(); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
107 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
108 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
109 | const C& container() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
110 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
111 | return m_container; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
112 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
113 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
114 | Iterator end() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
115 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
116 | return m_container.end(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
117 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
118 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
119 | ConstIterator end() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
120 | { |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
121 | return m_container.end(); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
122 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
123 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
124 | Iterator find (const T& needle) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
125 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
126 | auto it = std::find (m_container.begin(), m_container.end(), needle); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
127 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
128 | if (it == m_container.end()) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
129 | return end(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
130 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
131 | return it; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
132 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
133 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
134 | ConstIterator find (const T& needle) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
135 | { |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
136 | auto it = std::find (m_container.begin(), m_container.end(), needle); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
137 | |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
138 | if (it == m_container.end()) |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
139 | return end(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
140 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
141 | return it; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
142 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
143 | |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
144 | Iterator find (bool (*func)(T const&)) |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
145 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
146 | for (Iterator it = begin(); it != end(); ++it) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
147 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
148 | if (func (*it)) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
149 | return it; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
150 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
151 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
152 | return end(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
153 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
154 | |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
155 | ConstIterator find (bool (*func)(T const&)) const |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
156 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
157 | for (ConstIterator it = begin(); it != end(); ++it) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
158 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
159 | if (func (*it)) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
160 | return it; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
161 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
162 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
163 | return end(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
164 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
165 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
166 | T& first() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
167 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
168 | return *begin(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
169 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
170 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
171 | const T& first() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
172 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
173 | return *begin(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
174 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
175 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
176 | void insert (int pos, const T& value) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
177 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
178 | m_container.insert (m_container.begin() + pos, value); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
179 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
180 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
181 | bool is_empty() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
182 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
183 | return size() == 0; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
184 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
185 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
186 | T& last() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
187 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
188 | return *(end() - 1); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
189 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
190 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
191 | const T& last() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
192 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
193 | return *(end() - 1); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
194 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
195 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
196 | void merge (const Self& other) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
197 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
198 | int oldsize = size(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
199 | resize (size() + other.size()); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
200 | std::copy (other.begin(), other.end(), begin() + oldsize); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
201 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
202 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
203 | bool pop (T& val) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
204 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
205 | if (is_empty()) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
206 | return false; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
207 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
208 | val = m_container[size() - 1]; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
209 | m_container.erase (m_container.end() - 1); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
210 | return true; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
211 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
212 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
213 | T& prepend (const T& value) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
214 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
215 | m_container.push_front (value); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
216 | return m_container[0]; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
217 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
218 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
219 | ReverseIterator rbegin() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
220 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
221 | return m_container.rbegin(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
222 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
223 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
224 | void remove_at (int pos) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
225 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
226 | assert (pos < size()); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
227 | m_container.erase (m_container.begin() + pos); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
228 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
229 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
230 | void remove_duplicates() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
231 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
232 | sort(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
233 | resize (std::distance (begin(), std::unique (begin(), end()))); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
234 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
235 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
236 | void remove_one (const T& valueToRemove) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
237 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
238 | auto it = std::find (m_container.begin(), m_container.end(), valueToRemove); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
239 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
240 | if (it != m_container.end()) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
241 | m_container.erase (it); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
242 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
243 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
244 | ReverseIterator rend() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
245 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
246 | return m_container.rend(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
247 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
248 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
249 | void resize (int size) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
250 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
251 | m_container.resize (size); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
252 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
253 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
254 | Self reverse() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
255 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
256 | Self rev; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
257 | std::copy (rbegin(), rend(), rev.begin()); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
258 | return rev; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
259 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
260 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
261 | int size() const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
262 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
263 | return m_container.size(); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
264 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
265 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
266 | void sort() |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
267 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
268 | std::sort (begin(), end()); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
269 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
270 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
271 | Self splice(int start, int end, int step = 1) const |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
272 | { |
164
e3794f48a589
Fixed Container::splice() method trimming the last element even when not supposed to
Teemu Piippo <teemu@compsta2.com>
parents:
163
diff
changeset
|
273 | start = clamp(start, 0, size()); |
e3794f48a589
Fixed Container::splice() method trimming the last element even when not supposed to
Teemu Piippo <teemu@compsta2.com>
parents:
163
diff
changeset
|
274 | end = clamp(end, 0, size()); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
275 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
276 | if (end <= start) |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
277 | { |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
278 | return Self(); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
279 | } |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
280 | else |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
281 | { |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
282 | Self result; |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
283 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
284 | for (int i : range(start, end, step)) |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
285 | result << operator[] (i); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
286 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
287 | return result; |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
288 | } |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
289 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
290 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
291 | Self splice(Range<int>& range) const |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
292 | { |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
293 | return splice(range.min(), range.max(), range.step()); |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
294 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
295 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
296 | Self& operator<< (const T& value) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
297 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
298 | append (value); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
299 | return *this; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
300 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
301 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
302 | Self& operator<< (const Self& vals) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
303 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
304 | merge (vals); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
305 | return *this; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
306 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
307 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
308 | T& operator[] (int n) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
309 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
310 | assert (n < size()); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
311 | return m_container[n]; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
312 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
313 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
314 | const T& operator[] (int n) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
315 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
316 | assert (n < size()); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
317 | return m_container[n]; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
318 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
319 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
320 | Self operator[] (Range<int> const& n) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
321 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
322 | return splice (n); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
323 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
324 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
325 | Self operator+ (const Self& other) const |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
326 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
327 | Self out (*this); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
328 | out.merge (other); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
329 | return out; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
330 | } |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
331 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | protected: |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
333 | C m_container; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
334 | }; |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
335 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
336 | // ------------------------------------------------------------------------------------------------- |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
337 | // |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | template<typename T, typename C> |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
339 | Container<T, C>& operator>> (const T& value, Container<T, C>& haystack) |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
340 | { |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
341 | haystack.prepend (value); |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
342 | return haystack; |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
343 | } |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
344 | |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
345 | // ------------------------------------------------------------------------------------------------- |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
346 | // |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
347 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
348 | template<typename T> |
87
53c2aecb9704
some work on MSVC support (still doesn't work yet...)
Teemu Piippo <tsapii@utu.fi>
parents:
73
diff
changeset
|
349 | class Vector : public Container<T, std::vector<T> > |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
350 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
351 | public: |
87
53c2aecb9704
some work on MSVC support (still doesn't work yet...)
Teemu Piippo <tsapii@utu.fi>
parents:
73
diff
changeset
|
352 | typedef Container<T, std::vector<T> > Super; |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
353 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
354 | Vector(){} |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
355 | |
148
19e98695e584
Made String::vsprintf behave properly with long strings.
Teemu Piippo <teemu@compsta2.com>
parents:
137
diff
changeset
|
356 | Vector(int numvalues) : |
19e98695e584
Made String::vsprintf behave properly with long strings.
Teemu Piippo <teemu@compsta2.com>
parents:
137
diff
changeset
|
357 | Super(numvalues){} |
19e98695e584
Made String::vsprintf behave properly with long strings.
Teemu Piippo <teemu@compsta2.com>
parents:
137
diff
changeset
|
358 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
359 | Vector (T* data, size_t length) : |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
360 | Super (std::vector<T> (data, data + length)) {} |
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
361 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
362 | Vector(std::initializer_list<T> initializerList) : |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
363 | Super(initializerList) {} |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
364 | |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
365 | Vector(const Super& other) : |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
366 | Super(other) {} |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
148
diff
changeset
|
367 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
368 | T* data() |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
369 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
370 | return Super::m_container.data(); |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
371 | } |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
372 | |
69
eb4c25284a19
Removed a lot of boilerplate code
Teemu Piippo <crimsondusk64@gmail.com>
parents:
51
diff
changeset
|
373 | const T* data() const |
1
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
374 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
375 | return Super::m_container.data(); |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
376 | } |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
377 | |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
378 | operator const T*() const |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
379 | { |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
380 | return data(); |
4dd5bde4e777
- a whole lot of supplementary source code!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
381 | } |
71 | 382 | }; |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
383 | |
180 | 384 | using ByteArray = std::vector<unsigned char>; |
385 | class String quote(const ByteArray& bytes); | |
158
de7574d292ad
Added the ByteArray typedef for Vector<unsigned char>
Teemu Piippo <teemu@compsta2.com>
parents:
157
diff
changeset
|
386 | |
179
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
387 | template<typename T> |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
388 | T splice(const T& container, int start, int end, int step = 1) |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
389 | { |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
390 | start = clamp(start, 0, static_cast<int>(container.size())); |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
391 | end = clamp(end, 0, static_cast<int>(container.size())); |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
392 | T result; |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
393 | result.reserve((end - start) / step); |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
394 | for (int i = start; i < end; i += step) |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
395 | { |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
396 | result.push_back(container[i]); |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
397 | } |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
398 | return result; |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
399 | } |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
400 | |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
401 | template<typename T> |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
402 | T splice(const T& container, Range<int>& range) |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
403 | { |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
404 | return splice(container, range.min(), range.max(), range.step()); |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
405 | } |
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
164
diff
changeset
|
406 | |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
87
diff
changeset
|
407 | END_ZFC_NAMESPACE |