YkESet 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +68 -0
- data/Rakefile +13 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Yk/EMMap/Iterator.html +626 -0
- data/docs/Yk/EMMap.html +1504 -0
- data/docs/Yk/EMSet/Iterator.html +626 -0
- data/docs/Yk/EMSet.html +1472 -0
- data/docs/Yk/EMap/Iterator.html +626 -0
- data/docs/Yk/EMap.html +1730 -0
- data/docs/Yk/ESet/Iterator.html +626 -0
- data/docs/Yk/ESet.html +1472 -0
- data/docs/Yk.html +126 -0
- data/docs/_index.html +170 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file_list.html +51 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +170 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +571 -0
- data/docs/top-level-namespace.html +110 -0
- data/eset.gemspec +29 -0
- data/ext/Yk/.ruby-version +1 -0
- data/ext/Yk/.yardoc/checksums +1 -0
- data/ext/Yk/.yardoc/complete +0 -0
- data/ext/Yk/.yardoc/object_types +0 -0
- data/ext/Yk/.yardoc/objects/root.dat +0 -0
- data/ext/Yk/.yardoc/proxy_types +0 -0
- data/ext/Yk/Makefile +267 -0
- data/ext/Yk/depend +2 -0
- data/ext/Yk/extconf.rb +7 -0
- data/ext/Yk/for_yard.rb +192 -0
- data/ext/Yk/for_yard_product.rb +397 -0
- data/ext/Yk/map_tz +78 -0
- data/ext/Yk/set_tz +77 -0
- data/ext/Yk/stl_map_tz.h +1026 -0
- data/ext/Yk/stl_multimap_tz.h +927 -0
- data/ext/Yk/stl_multiset_tz.h +805 -0
- data/ext/Yk/stl_set_tz.h +815 -0
- data/ext/Yk/stl_set_tz_ruby.cpp +575 -0
- data/ext/Yk/stl_tree_tz.h +1865 -0
- data/ext/Yk/test_set.rb +115 -0
- data/ext/Yk/tree_tz.cc +489 -0
- data/ext/Yk/tz_stl_auto.cpp +84 -0
- data/lib/eset/version.rb +3 -0
- data/lib/eset.rb +7 -0
- metadata +101 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# namespace Yk
|
|
2
|
+
module Yk
|
|
3
|
+
# ESets are containers with external iterators that store unique elements following a specific order. For use, require 'Yk/ESet';include Yk;
|
|
4
|
+
class ESet
|
|
5
|
+
# initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
|
|
6
|
+
# @yieldparam [Object] obj object pointed by an element.
|
|
7
|
+
# @yieldreturn [Object] should be comparable with method, '<'.
|
|
8
|
+
def initialize
|
|
9
|
+
end
|
|
10
|
+
# @return [ESet::Iterator] Return iterator to beginning
|
|
11
|
+
def begin
|
|
12
|
+
end
|
|
13
|
+
# @return [ESet::Iterator] Return iterator to end
|
|
14
|
+
def end
|
|
15
|
+
end
|
|
16
|
+
# @return [Integer] Return container size
|
|
17
|
+
def size
|
|
18
|
+
end
|
|
19
|
+
# Clear content
|
|
20
|
+
def clear
|
|
21
|
+
end
|
|
22
|
+
# @return [ESet::Iterator] Return iterator to upper bound
|
|
23
|
+
def upper_bound
|
|
24
|
+
end
|
|
25
|
+
# @return [ESet::Iterator] Return iterator to lower bound
|
|
26
|
+
def lower_bound
|
|
27
|
+
end
|
|
28
|
+
# @overload insert(position, obj)
|
|
29
|
+
# Insert element with an object using a hint
|
|
30
|
+
# @param [ESet::Iterator] position Hint for the position where the element can be inserted.
|
|
31
|
+
# @param [Object] obj Object to be pointed by the inserted elements.
|
|
32
|
+
# @return [ESet::Iterator] An iterator pointing to either the newly inserted element or to the element that already had its equivalent in the container.
|
|
33
|
+
# @overload insert(obj)
|
|
34
|
+
# Insert element with an object
|
|
35
|
+
# @param [Object] obj key object to be pointed by the inserted elements.
|
|
36
|
+
# @return [Array] An array, with its first member set to an iterator pointing to either the newly inserted element or to the equivalent element already in the set. The second member in the array is set to true if a new element was inserted or false if an equivalent element already existed.
|
|
37
|
+
def insert *args
|
|
38
|
+
end
|
|
39
|
+
# Removes from the set container a range of elements ([first,last)).
|
|
40
|
+
# Iterators specifying a range within the set container to be removed: [first,last). i.e., the range includes all the elements between first and last, including the element pointed by first but not the one pointed by last.
|
|
41
|
+
# @param [ESet::Iterator] first first iterator.
|
|
42
|
+
# @param [ESet::Iterator] last last iterator.
|
|
43
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
44
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
45
|
+
# @raise RangeError raised when erasing end iterator
|
|
46
|
+
def erase first, last
|
|
47
|
+
end
|
|
48
|
+
# Searches the container for an element with an object equivalent to the third argument and/or validated with the provided block in a range of elements ([first,last)), 'obj' and returns an iterator to it if found, otherwise it returns an iterator to .
|
|
49
|
+
# @param [ESet::Iterator] first first iterator.
|
|
50
|
+
# @param [ESet::Iterator] last last iterator.
|
|
51
|
+
# @param obj Object to search equivalency.
|
|
52
|
+
# @yieldparam [Object] obj object argument pointed by an element passed for validation with the block
|
|
53
|
+
# @yieldreturn [Object] validation result from the block
|
|
54
|
+
# @return [ESet::Iterator] iterator pointing the element with equivalent object.
|
|
55
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
56
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
57
|
+
# @raise ArgumentError raised when neither parameter, obj nor block is provided.
|
|
58
|
+
# @raise RangeError raised when dereferencing end iterator
|
|
59
|
+
def ESet.find first, last, obj = nil
|
|
60
|
+
end
|
|
61
|
+
# Applies given block to each of the elements in the range [first,last).
|
|
62
|
+
# @param [ESet::Iterator] first first iterator.
|
|
63
|
+
# @param [ESet::Iterator] last last iterator.
|
|
64
|
+
# @yieldparam [Object] obj object in an element
|
|
65
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
66
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
67
|
+
def ESet.for_each first, last
|
|
68
|
+
end
|
|
69
|
+
# Iterator class, pointing an element in container
|
|
70
|
+
class Iterator
|
|
71
|
+
# increment the position
|
|
72
|
+
# @return [ESet::Iterator] self
|
|
73
|
+
# @raise RangeError raised when advancing over the end
|
|
74
|
+
def inc
|
|
75
|
+
end
|
|
76
|
+
# decrement the position
|
|
77
|
+
# @return [ESet::Iterator] self
|
|
78
|
+
# @raise RangeError raised when rewinding over the beginning
|
|
79
|
+
def dec
|
|
80
|
+
end
|
|
81
|
+
# compare for equivalence of positions
|
|
82
|
+
# @return true or false
|
|
83
|
+
# @raise ArgumentError raised in case right operand is not compatible
|
|
84
|
+
def == arg
|
|
85
|
+
end
|
|
86
|
+
# compare for unequivalence of positions
|
|
87
|
+
# @return true or false
|
|
88
|
+
# @raise ArgumentError raised in case right operand is not compatible
|
|
89
|
+
def !=
|
|
90
|
+
end
|
|
91
|
+
# dereference the iterator, and returns the pointed object
|
|
92
|
+
# @return [Object] The pointed object
|
|
93
|
+
def item
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
# EMSets are containers with external iterators that store elements following a specific order, and where multiple elements can have equivalent values. For use, require 'Yk/ESet';include Yk;
|
|
98
|
+
class EMSet
|
|
99
|
+
# initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
|
|
100
|
+
# @yieldparam [Object] obj object pointed by an element.
|
|
101
|
+
# @yieldreturn [Object] should be comparable with method, '<'.
|
|
102
|
+
def initialize
|
|
103
|
+
end
|
|
104
|
+
# @return [EMSet::Iterator] Return iterator to beginning
|
|
105
|
+
def begin
|
|
106
|
+
end
|
|
107
|
+
# @return [EMSet::Iterator] Return iterator to end
|
|
108
|
+
def end
|
|
109
|
+
end
|
|
110
|
+
# @return [Integer] Return container size
|
|
111
|
+
def size
|
|
112
|
+
end
|
|
113
|
+
# Clear content
|
|
114
|
+
def clear
|
|
115
|
+
end
|
|
116
|
+
# @return [EMSet::Iterator] Return iterator to upper bound
|
|
117
|
+
def upper_bound
|
|
118
|
+
end
|
|
119
|
+
# @return [EMSet::Iterator] Return iterator to lower bound
|
|
120
|
+
def lower_bound
|
|
121
|
+
end
|
|
122
|
+
# @overload insert(position, obj)
|
|
123
|
+
# Insert element with an object using a hint
|
|
124
|
+
# @param [EMSet::Iterator] position Hint for the position where the element can be inserted.
|
|
125
|
+
# @param [Object] obj Object to be pointed by the inserted elements.
|
|
126
|
+
# @return [EMSet::Iterator] An iterator pointing to either the newly inserted element.
|
|
127
|
+
# @overload insert(obj)
|
|
128
|
+
# Insert element with an object
|
|
129
|
+
# @param [Object] obj key object to be pointed by the inserted elements.
|
|
130
|
+
# @return [EMSet::Iterator] An iterator pointing to either the newly inserted element.
|
|
131
|
+
def insert *args
|
|
132
|
+
end
|
|
133
|
+
# Removes from the set container a range of elements ([first,last)).
|
|
134
|
+
# Iterators specifying a range within the set container to be removed: [first,last). i.e., the range includes all the elements between first and last, including the element pointed by first but not the one pointed by last.
|
|
135
|
+
# @param [EMSet::Iterator] first first iterator.
|
|
136
|
+
# @param [EMSet::Iterator] last last iterator.
|
|
137
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
138
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
139
|
+
# @raise RangeError raised when erasing end iterator
|
|
140
|
+
def erase first, last
|
|
141
|
+
end
|
|
142
|
+
# Searches the container for an element with an object equivalent to the third argument and/or validated with the provided block in a range of elements ([first,last)), 'obj' and returns an iterator to it if found, otherwise it returns an iterator to .
|
|
143
|
+
# @param [EMSet::Iterator] first first iterator.
|
|
144
|
+
# @param [EMSet::Iterator] last last iterator.
|
|
145
|
+
# @param obj Object to search equivalency.
|
|
146
|
+
# @yieldparam [Object] obj object argument pointed by an element passed for validation with the block
|
|
147
|
+
# @yieldreturn [Object] validation result from the block
|
|
148
|
+
# @return [EMSet::Iterator] iterator pointing the element with equivalent object.
|
|
149
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
150
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
151
|
+
# @raise ArgumentError raised when neither parameter, obj nor block is provided.
|
|
152
|
+
# @raise RangeError raised when dereferencing end iterator
|
|
153
|
+
def EMSet.find first, last, obj = nil
|
|
154
|
+
end
|
|
155
|
+
# Applies given block to each of the elements in the range [first,last).
|
|
156
|
+
# @param [EMSet::Iterator] first first iterator.
|
|
157
|
+
# @param [EMSet::Iterator] last last iterator.
|
|
158
|
+
# @yieldparam [Object] obj object in an element
|
|
159
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
160
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
161
|
+
def EMSet.for_each first, last
|
|
162
|
+
end
|
|
163
|
+
# Iterator class, pointing an element in container
|
|
164
|
+
class Iterator
|
|
165
|
+
# increment the position
|
|
166
|
+
# @return [EMSet::Iterator] self
|
|
167
|
+
# @raise RangeError raised when advancing over the end
|
|
168
|
+
def inc
|
|
169
|
+
end
|
|
170
|
+
# decrement the position
|
|
171
|
+
# @return [EMSet::Iterator] self
|
|
172
|
+
# @raise RangeError raised when rewinding over the beginning
|
|
173
|
+
def dec
|
|
174
|
+
end
|
|
175
|
+
# compare for equivalence of positions
|
|
176
|
+
# @return true or false
|
|
177
|
+
# @raise ArgumentError raised in case right operand is not compatible
|
|
178
|
+
def == arg
|
|
179
|
+
end
|
|
180
|
+
# compare for unequivalence of positions
|
|
181
|
+
# @return true or false
|
|
182
|
+
# @raise ArgumentError raised in case right operand is not compatible
|
|
183
|
+
def !=
|
|
184
|
+
end
|
|
185
|
+
# dereference the iterator, and returns the pointed object
|
|
186
|
+
# @return [Object] The pointed object
|
|
187
|
+
def item
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
# EMaps are associative containers with external iterators that store elements formed by a combination of a key and a value, following a specific order. For use, require 'Yk/ESet';include Yk;
|
|
192
|
+
class EMap
|
|
193
|
+
# initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
|
|
194
|
+
# @yieldparam [Object] key object pointed by an element.
|
|
195
|
+
# @yieldreturn [Object] should be comparable with method, '<'.
|
|
196
|
+
def initialize
|
|
197
|
+
end
|
|
198
|
+
# @return [EMap::Iterator] Return iterator to beginning
|
|
199
|
+
def begin
|
|
200
|
+
end
|
|
201
|
+
# @return [EMap::Iterator] Return iterator to end
|
|
202
|
+
def end
|
|
203
|
+
end
|
|
204
|
+
# @return [Integer] Return container size
|
|
205
|
+
def size
|
|
206
|
+
end
|
|
207
|
+
# Clear content
|
|
208
|
+
def clear
|
|
209
|
+
end
|
|
210
|
+
# @return [EMap::Iterator] Return iterator to upper bound
|
|
211
|
+
def upper_bound
|
|
212
|
+
end
|
|
213
|
+
# @return [EMap::Iterator] Return iterator to lower bound
|
|
214
|
+
def lower_bound
|
|
215
|
+
end
|
|
216
|
+
# @overload insert(position, key, value)
|
|
217
|
+
# Insert element with an object using a hint
|
|
218
|
+
# @param [EMap::Iterator] position Hint for the position where the element can be inserted.
|
|
219
|
+
# @param [Object] key key object to be pointed by the inserted elements.
|
|
220
|
+
# @param [Object] value value object to be pointed by the inserted elements.
|
|
221
|
+
# @return [EMap::Iterator] An iterator pointing to either the newly inserted element or to the element that already had its equivalent in the container.
|
|
222
|
+
# @overload insert(key, value)
|
|
223
|
+
# Insert element with an object
|
|
224
|
+
# @param [Object] key key object to be pointed by the inserted elements.
|
|
225
|
+
# @param [Object] value value object to be pointed by the inserted elements.
|
|
226
|
+
# @return [Array] An array, with its first member set to an iterator pointing to either the newly inserted element or to the equivalent element already in the set. The second member in the array is set to true if a new element was inserted or false if an equivalent element already existed.
|
|
227
|
+
def insert *args
|
|
228
|
+
end
|
|
229
|
+
# @overload insert_or_assign(k, v)
|
|
230
|
+
# If a key equivalent to 'k' already exists in the container, assigns 'v' to value corresponding to the key. If the key does not exist, inserts the new value as if by insert.
|
|
231
|
+
# @param [Object] k key object
|
|
232
|
+
# @param [Object] v value object
|
|
233
|
+
# @return [Array] An array, with its first member set to an iterator pointing to either the newly inserted element or to the equivalent element already in the set. The second member in the array is set to true if a new element was inserted or false if an equivalent element already existed.
|
|
234
|
+
# @overload insert_or_assign(position, k, v)
|
|
235
|
+
# Insert element with key and value using a hint
|
|
236
|
+
# @param [EMap::Iterator] position Hint for the position where the element can be inserted.
|
|
237
|
+
# @param [Object] k key object
|
|
238
|
+
# @param [Object] v value object
|
|
239
|
+
# @return [EMap::Iterator] Iterator pointing at the element that was inserted or updated
|
|
240
|
+
def insert_or_assign *args
|
|
241
|
+
end
|
|
242
|
+
# Removes from the set container a range of elements ([first,last)).
|
|
243
|
+
# Iterators specifying a range within the set container to be removed: [first,last). i.e., the range includes all the elements between first and last, including the element pointed by first but not the one pointed by last.
|
|
244
|
+
# @param [EMap::Iterator] first first iterator.
|
|
245
|
+
# @param [EMap::Iterator] last last iterator.
|
|
246
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
247
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
248
|
+
# @raise RangeError raised when erasing end iterator
|
|
249
|
+
def erase first, last
|
|
250
|
+
end
|
|
251
|
+
# Searches the container for an element with an object equivalent to the third argument and/or validated with the provided block in a range of elements ([first,last)), 'obj' and returns an iterator to it if found, otherwise it returns an iterator to .
|
|
252
|
+
# @param [EMap::Iterator] first first iterator.
|
|
253
|
+
# @param [EMap::Iterator] last last iterator.
|
|
254
|
+
# @param obj Object to search equivalency.
|
|
255
|
+
# @yieldparam [Object] obj object argument pointed by an element passed for validation with the block
|
|
256
|
+
# @yieldreturn [Object] validation result from the block
|
|
257
|
+
# @return [EMap::Iterator] iterator pointing the element with equivalent object.
|
|
258
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
259
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
260
|
+
# @raise ArgumentError raised when neither parameter, obj nor block is provided.
|
|
261
|
+
# @raise RangeError raised when dereferencing end iterator
|
|
262
|
+
def EMap.find first, last, obj = nil
|
|
263
|
+
end
|
|
264
|
+
# Applies given block to each of the elements in the range [first,last).
|
|
265
|
+
# @param [EMap::Iterator] first first iterator.
|
|
266
|
+
# @param [EMap::Iterator] last last iterator.
|
|
267
|
+
# @yieldparam [Object] obj object in an element
|
|
268
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
269
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
270
|
+
def EMap.for_each first, last
|
|
271
|
+
end
|
|
272
|
+
# Iterator class, pointing an element in container
|
|
273
|
+
class Iterator
|
|
274
|
+
# increment the position
|
|
275
|
+
# @return [EMap::Iterator] self
|
|
276
|
+
# @raise RangeError raised when advancing over the end
|
|
277
|
+
def inc
|
|
278
|
+
end
|
|
279
|
+
# decrement the position
|
|
280
|
+
# @return [EMap::Iterator] self
|
|
281
|
+
# @raise RangeError raised when rewinding over the beginning
|
|
282
|
+
def dec
|
|
283
|
+
end
|
|
284
|
+
# compare for equivalence of positions
|
|
285
|
+
# @return true or false
|
|
286
|
+
# @raise ArgumentError raised in case right operand is not compatible
|
|
287
|
+
def == arg
|
|
288
|
+
end
|
|
289
|
+
# compare for unequivalence of positions
|
|
290
|
+
# @return true or false
|
|
291
|
+
# @raise ArgumentError raised in case right operand is not compatible
|
|
292
|
+
def !=
|
|
293
|
+
end
|
|
294
|
+
# dereference the iterator, and returns the key object and the value object
|
|
295
|
+
# @return [Array] Array of the pointed key object and value object
|
|
296
|
+
def item
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
# EMMaps are associative containers with external iterators that store elements formed by a combination of a key and a value, following a specific order, and where multiple elements can have equivalent keys. For use, 'Yk/ESet';include Yk;
|
|
301
|
+
class EMMap
|
|
302
|
+
# initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
|
|
303
|
+
# @yieldparam [Object] key object pointed by an element.
|
|
304
|
+
# @yieldreturn [Object] should be comparable with method, '<'.
|
|
305
|
+
def initialize
|
|
306
|
+
end
|
|
307
|
+
# @return [EMMap::Iterator] Return iterator to beginning
|
|
308
|
+
def begin
|
|
309
|
+
end
|
|
310
|
+
# @return [EMMap::Iterator] Return iterator to end
|
|
311
|
+
def end
|
|
312
|
+
end
|
|
313
|
+
# @return [Integer] Return container size
|
|
314
|
+
def size
|
|
315
|
+
end
|
|
316
|
+
# Clear content
|
|
317
|
+
def clear
|
|
318
|
+
end
|
|
319
|
+
# @return [EMMap::Iterator] Return iterator to upper bound
|
|
320
|
+
def upper_bound
|
|
321
|
+
end
|
|
322
|
+
# @return [EMMap::Iterator] Return iterator to lower bound
|
|
323
|
+
def lower_bound
|
|
324
|
+
end
|
|
325
|
+
# @overload insert(position, key, value)
|
|
326
|
+
# Insert element with an object using a hint
|
|
327
|
+
# @param [EMMap::Iterator] position Hint for the position where the element can be inserted.
|
|
328
|
+
# @param [Object] key key object to be pointed by the inserted elements.
|
|
329
|
+
# @param [Object] value value object to be pointed by the inserted elements.
|
|
330
|
+
# @return [EMMap::Iterator] An iterator pointing to either the newly inserted element.
|
|
331
|
+
# @overload insert(key, value)
|
|
332
|
+
# Insert element with an object
|
|
333
|
+
# @param [Object] key key object to be pointed by the inserted elements.
|
|
334
|
+
# @param [Object] value value object to be pointed by the inserted elements.
|
|
335
|
+
# @return [EMMap::Iterator] An iterator pointing to either the newly inserted element.
|
|
336
|
+
def insert *args
|
|
337
|
+
end
|
|
338
|
+
# Removes from the set container a range of elements ([first,last)).
|
|
339
|
+
# Iterators specifying a range within the set container to be removed: [first,last). i.e., the range includes all the elements between first and last, including the element pointed by first but not the one pointed by last.
|
|
340
|
+
# @param [EMMap::Iterator] first first iterator.
|
|
341
|
+
# @param [EMMap::Iterator] last last iterator.
|
|
342
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
343
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
344
|
+
# @raise RangeError raised when erasing end iterator
|
|
345
|
+
def erase first, last
|
|
346
|
+
end
|
|
347
|
+
# Searches the container for an element with an object equivalent to the third argument and/or validated with the provided block in a range of elements ([first,last)), 'obj' and returns an iterator to it if found, otherwise it returns an iterator to .
|
|
348
|
+
# @param [EMMap::Iterator] first first iterator.
|
|
349
|
+
# @param [EMMap::Iterator] last last iterator.
|
|
350
|
+
# @param obj Object to search equivalency.
|
|
351
|
+
# @yieldparam [Object] obj object argument pointed by an element passed for validation with the block
|
|
352
|
+
# @yieldreturn [Object] validation result from the block
|
|
353
|
+
# @return [EMMap::Iterator] iterator pointing the element with equivalent object.
|
|
354
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
355
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
356
|
+
# @raise ArgumentError raised when neither parameter, obj nor block is provided.
|
|
357
|
+
# @raise RangeError raised when dereferencing end iterator
|
|
358
|
+
def EMMap.find first, last, obj = nil
|
|
359
|
+
end
|
|
360
|
+
# Applies given block to each of the elements in the range [first,last).
|
|
361
|
+
# @param [EMMap::Iterator] first first iterator.
|
|
362
|
+
# @param [EMMap::Iterator] last last iterator.
|
|
363
|
+
# @yieldparam [Object] obj object in an element
|
|
364
|
+
# @raise ArgumentError raised when an argument is not a compatible iterator.
|
|
365
|
+
# @raise ArgumentError raised when first and last iterators are not from the same container.
|
|
366
|
+
def EMMap.for_each first, last
|
|
367
|
+
end
|
|
368
|
+
# Iterator class, pointing an element in container
|
|
369
|
+
class Iterator
|
|
370
|
+
# increment the position
|
|
371
|
+
# @return [EMMap::Iterator] self
|
|
372
|
+
# @raise RangeError raised when advancing over the end
|
|
373
|
+
def inc
|
|
374
|
+
end
|
|
375
|
+
# decrement the position
|
|
376
|
+
# @return [EMMap::Iterator] self
|
|
377
|
+
# @raise RangeError raised when rewinding over the beginning
|
|
378
|
+
def dec
|
|
379
|
+
end
|
|
380
|
+
# compare for equivalence of positions
|
|
381
|
+
# @return true or false
|
|
382
|
+
# @raise ArgumentError raised in case right operand is not compatible
|
|
383
|
+
def == arg
|
|
384
|
+
end
|
|
385
|
+
# compare for unequivalence of positions
|
|
386
|
+
# @return true or false
|
|
387
|
+
# @raise ArgumentError raised in case right operand is not compatible
|
|
388
|
+
def !=
|
|
389
|
+
end
|
|
390
|
+
# dereference the iterator, and returns the key object and the value object
|
|
391
|
+
# @return [Array] Array of the pointed key object and value object
|
|
392
|
+
def item
|
|
393
|
+
end
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
end # module Yk
|
data/ext/Yk/map_tz
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// <map> -*- C++ -*-
|
|
2
|
+
|
|
3
|
+
// Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
|
4
|
+
//
|
|
5
|
+
// This file is part of the GNU ISO C++ Library. This library is free
|
|
6
|
+
// software; you can redistribute it and/or modify it under the
|
|
7
|
+
// terms of the GNU General Public License as published by the
|
|
8
|
+
// Free Software Foundation; either version 3, or (at your option)
|
|
9
|
+
// any later version.
|
|
10
|
+
|
|
11
|
+
// This library is distributed in the hope that it will be useful,
|
|
12
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
// GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
// Under Section 7 of GPL version 3, you are granted additional
|
|
17
|
+
// permissions described in the GCC Runtime Library Exception, version
|
|
18
|
+
// 3.1, as published by the Free Software Foundation.
|
|
19
|
+
|
|
20
|
+
// You should have received a copy of the GNU General Public License and
|
|
21
|
+
// a copy of the GCC Runtime Library Exception along with this program;
|
|
22
|
+
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
23
|
+
// <http://www.gnu.org/licenses/>.
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
*
|
|
27
|
+
* Copyright (c) 1994
|
|
28
|
+
* Hewlett-Packard Company
|
|
29
|
+
*
|
|
30
|
+
* Permission to use, copy, modify, distribute and sell this software
|
|
31
|
+
* and its documentation for any purpose is hereby granted without fee,
|
|
32
|
+
* provided that the above copyright notice appear in all copies and
|
|
33
|
+
* that both that copyright notice and this permission notice appear
|
|
34
|
+
* in supporting documentation. Hewlett-Packard Company makes no
|
|
35
|
+
* representations about the suitability of this software for any
|
|
36
|
+
* purpose. It is provided "as is" without express or implied warranty.
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) 1996,1997
|
|
40
|
+
* Silicon Graphics Computer Systems, Inc.
|
|
41
|
+
*
|
|
42
|
+
* Permission to use, copy, modify, distribute and sell this software
|
|
43
|
+
* and its documentation for any purpose is hereby granted without fee,
|
|
44
|
+
* provided that the above copyright notice appear in all copies and
|
|
45
|
+
* that both that copyright notice and this permission notice appear
|
|
46
|
+
* in supporting documentation. Silicon Graphics makes no
|
|
47
|
+
* representations about the suitability of this software for any
|
|
48
|
+
* purpose. It is provided "as is" without express or implied warranty.
|
|
49
|
+
*
|
|
50
|
+
* Copyright (c) 2020
|
|
51
|
+
*
|
|
52
|
+
* Yougaein@github (Kokeji Yougain)
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/** @file include/map
|
|
56
|
+
* This is a Standard C++ Library header.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
#ifndef _GLIBCXX_MAP
|
|
60
|
+
#define _GLIBCXX_MAP 1
|
|
61
|
+
|
|
62
|
+
#pragma GCC system_header
|
|
63
|
+
|
|
64
|
+
#include "stl_tree_tz.h"
|
|
65
|
+
#include "stl_map_tz.h"
|
|
66
|
+
#include "stl_multimap_tz.h"
|
|
67
|
+
|
|
68
|
+
#include <bits/range_access.h>
|
|
69
|
+
|
|
70
|
+
#ifdef _GLIBCXX_DEBUG
|
|
71
|
+
# include <debug/map>
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
#ifdef _GLIBCXX_PROFILE
|
|
75
|
+
# include <profile/map>
|
|
76
|
+
#endif
|
|
77
|
+
|
|
78
|
+
#endif /* _GLIBCXX_MAP */
|
data/ext/Yk/set_tz
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// <set> -*- C++ -*-
|
|
2
|
+
|
|
3
|
+
// Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
|
4
|
+
//
|
|
5
|
+
// This file is part of the GNU ISO C++ Library. This library is free
|
|
6
|
+
// software; you can redistribute it and/or modify it under the
|
|
7
|
+
// terms of the GNU General Public License as published by the
|
|
8
|
+
// Free Software Foundation; either version 3, or (at your option)
|
|
9
|
+
// any later version.
|
|
10
|
+
|
|
11
|
+
// This library is distributed in the hope that it will be useful,
|
|
12
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
// GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
// Under Section 7 of GPL version 3, you are granted additional
|
|
17
|
+
// permissions described in the GCC Runtime Library Exception, version
|
|
18
|
+
// 3.1, as published by the Free Software Foundation.
|
|
19
|
+
|
|
20
|
+
// You should have received a copy of the GNU General Public License and
|
|
21
|
+
// a copy of the GCC Runtime Library Exception along with this program;
|
|
22
|
+
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
23
|
+
// <http://www.gnu.org/licenses/>.
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
*
|
|
27
|
+
* Copyright (c) 1994
|
|
28
|
+
* Hewlett-Packard Company
|
|
29
|
+
*
|
|
30
|
+
* Permission to use, copy, modify, distribute and sell this software
|
|
31
|
+
* and its documentation for any purpose is hereby granted without fee,
|
|
32
|
+
* provided that the above copyright notice appear in all copies and
|
|
33
|
+
* that both that copyright notice and this permission notice appear
|
|
34
|
+
* in supporting documentation. Hewlett-Packard Company makes no
|
|
35
|
+
* representations about the suitability of this software for any
|
|
36
|
+
* purpose. It is provided "as is" without express or implied warranty.
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) 1996,1997
|
|
40
|
+
* Silicon Graphics Computer Systems, Inc.
|
|
41
|
+
*
|
|
42
|
+
* Permission to use, copy, modify, distribute and sell this software
|
|
43
|
+
* and its documentation for any purpose is hereby granted without fee,
|
|
44
|
+
* provided that the above copyright notice appear in all copies and
|
|
45
|
+
* that both that copyright notice and this permission notice appear
|
|
46
|
+
* in supporting documentation. Silicon Graphics makes no
|
|
47
|
+
* representations about the suitability of this software for any
|
|
48
|
+
* purpose. It is provided "as is" without express or implied warranty.
|
|
49
|
+
*
|
|
50
|
+
* Copyright (c) 2020
|
|
51
|
+
*
|
|
52
|
+
* Yougaein@github (Kokeji Yougain)
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/** @file include/set
|
|
56
|
+
* This is a Standard C++ Library header.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
#ifndef _GLIBCXX_SET
|
|
60
|
+
#define _GLIBCXX_SET 1
|
|
61
|
+
|
|
62
|
+
#pragma GCC system_header
|
|
63
|
+
|
|
64
|
+
#include "stl_tree_tz.h"
|
|
65
|
+
#include "stl_set_tz.h"
|
|
66
|
+
#include "stl_multiset_tz.h"
|
|
67
|
+
#include <bits/range_access.h>
|
|
68
|
+
|
|
69
|
+
#ifdef _GLIBCXX_DEBUG
|
|
70
|
+
# include <debug/set>
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
#ifdef _GLIBCXX_PROFILE
|
|
74
|
+
# include <profile/set>
|
|
75
|
+
#endif
|
|
76
|
+
|
|
77
|
+
#endif /* _GLIBCXX_SET */
|