/src/qpdf/libqpdf/QPDF_Array.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include <qpdf/QPDFObjectHandle_private.hh> |
2 | | |
3 | | #include <qpdf/QTC.hh> |
4 | | |
5 | | #include <array> |
6 | | #include <utility> |
7 | | |
8 | | using namespace std::literals; |
9 | | using namespace qpdf; |
10 | | |
11 | | static const QPDFObjectHandle null_oh = QPDFObjectHandle::newNull(); |
12 | | |
13 | | static size_t |
14 | | to_s(int n) |
15 | 940 | { |
16 | 940 | return static_cast<size_t>(n); |
17 | 940 | } |
18 | | |
19 | | static int |
20 | | to_i(size_t n) |
21 | 138k | { |
22 | 138k | return static_cast<int>(n); |
23 | 138k | } |
24 | | |
25 | | inline void |
26 | | Array::checkOwnership(QPDFObjectHandle const& item) const |
27 | 0 | { |
28 | 0 | if (!item) { |
29 | 0 | throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array."); |
30 | 0 | } |
31 | 0 | if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) { |
32 | 0 | throw std::logic_error( |
33 | 0 | "Attempting to add an object from a different QPDF. Use " |
34 | 0 | "QPDF::copyForeignObject to add objects from another file."); |
35 | 0 | } |
36 | 0 | } |
37 | | |
38 | | QPDF_Array::QPDF_Array(std::vector<QPDFObjectHandle>&& v, bool sparse) |
39 | 661 | { |
40 | 661 | if (sparse) { |
41 | 353 | sp = std::make_unique<Sparse>(); |
42 | 155k | for (auto& item: v) { |
43 | 155k | if (item.raw_type_code() != ::ot_null || item.indirect()) { |
44 | 84.1k | sp->elements[sp->size] = std::move(item); |
45 | 84.1k | } |
46 | 155k | ++sp->size; |
47 | 155k | } |
48 | 353 | } else { |
49 | 308 | elements = std::move(v); |
50 | 308 | } |
51 | 661 | } |
52 | | |
53 | | QPDF_Array* |
54 | | Array::array() const |
55 | 19.6k | { |
56 | 19.6k | if (auto a = as<QPDF_Array>()) { |
57 | 19.6k | return a; |
58 | 19.6k | } |
59 | | |
60 | 0 | throw std::runtime_error("Expected an array but found a non-array object"); |
61 | 0 | return nullptr; // unreachable |
62 | 19.6k | } |
63 | | |
64 | | Array::Array(bool empty) : |
65 | 0 | BaseHandle(empty ? QPDFObject::create<QPDF_Array>() : nullptr) |
66 | 0 | { |
67 | 0 | } |
68 | | |
69 | | Array::Array(std::vector<QPDFObjectHandle> const& items) : |
70 | 0 | BaseHandle(QPDFObject::create<QPDF_Array>(items)) |
71 | 0 | { |
72 | 0 | } |
73 | | |
74 | | Array::Array(std::vector<QPDFObjectHandle>&& items) : |
75 | 0 | BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items))) |
76 | 0 | { |
77 | 0 | } |
78 | | |
79 | | Array::iterator |
80 | | Array::begin() |
81 | 313k | { |
82 | 313k | if (auto a = as<QPDF_Array>()) { |
83 | 296k | if (!a->sp) { |
84 | 296k | return a->elements.begin(); |
85 | 296k | } |
86 | 712 | if (!sp_elements) { |
87 | 712 | sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector()); |
88 | 712 | } |
89 | 712 | return sp_elements->begin(); |
90 | 296k | } |
91 | 16.1k | return {}; |
92 | 313k | } |
93 | | |
94 | | Array::iterator |
95 | | Array::end() |
96 | 313k | { |
97 | 313k | if (auto a = as<QPDF_Array>()) { |
98 | 296k | if (!a->sp) { |
99 | 296k | return a->elements.end(); |
100 | 296k | } |
101 | 712 | if (!sp_elements) { |
102 | 0 | sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector()); |
103 | 0 | } |
104 | 712 | return sp_elements->end(); |
105 | 296k | } |
106 | 16.1k | return {}; |
107 | 313k | } |
108 | | |
109 | | Array::const_iterator |
110 | | Array::cbegin() |
111 | 0 | { |
112 | 0 | if (auto a = as<QPDF_Array>()) { |
113 | 0 | if (!a->sp) { |
114 | 0 | return a->elements.cbegin(); |
115 | 0 | } |
116 | 0 | if (!sp_elements) { |
117 | 0 | sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector()); |
118 | 0 | } |
119 | 0 | return sp_elements->cbegin(); |
120 | 0 | } |
121 | 0 | return {}; |
122 | 0 | } |
123 | | |
124 | | Array::const_iterator |
125 | | Array::cend() |
126 | 0 | { |
127 | 0 | if (auto a = as<QPDF_Array>()) { |
128 | 0 | if (!a->sp) { |
129 | 0 | return a->elements.cend(); |
130 | 0 | } |
131 | 0 | if (!sp_elements) { |
132 | 0 | sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector()); |
133 | 0 | } |
134 | 0 | return sp_elements->cend(); |
135 | 0 | } |
136 | 0 | return {}; |
137 | 0 | } |
138 | | |
139 | | Array::const_reverse_iterator |
140 | | Array::crbegin() |
141 | 530k | { |
142 | 530k | if (auto a = as<QPDF_Array>()) { |
143 | 28.5k | if (!a->sp) { |
144 | 28.5k | return a->elements.crbegin(); |
145 | 28.5k | } |
146 | 28 | if (!sp_elements) { |
147 | 28 | sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector()); |
148 | 28 | } |
149 | 28 | return sp_elements->crbegin(); |
150 | 28.5k | } |
151 | 502k | return {}; |
152 | 530k | } |
153 | | |
154 | | Array::const_reverse_iterator |
155 | | Array::crend() |
156 | 530k | { |
157 | 530k | if (auto a = as<QPDF_Array>()) { |
158 | 28.5k | if (!a->sp) { |
159 | 28.5k | return a->elements.crend(); |
160 | 28.5k | } |
161 | 28 | if (!sp_elements) { |
162 | 0 | sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector()); |
163 | 0 | } |
164 | 28 | return sp_elements->crend(); |
165 | 28.5k | } |
166 | 502k | return {}; |
167 | 530k | } |
168 | | |
169 | | QPDFObjectHandle |
170 | | Array::null() const |
171 | 0 | { |
172 | 0 | return null_oh; |
173 | 0 | } |
174 | | |
175 | | size_t |
176 | | Array::size() const |
177 | 36.1k | { |
178 | 36.1k | if (auto a = as<QPDF_Array>()) { |
179 | 20.1k | return a->sp ? a->sp->size : a->elements.size(); |
180 | 20.1k | } |
181 | 15.9k | return 0; |
182 | 36.1k | } |
183 | | |
184 | | QPDFObjectHandle const& |
185 | | Array::operator[](size_t n) const |
186 | 132k | { |
187 | 132k | static const QPDFObjectHandle null_obj; |
188 | 132k | auto a = as<QPDF_Array>(); |
189 | 132k | if (!a) { |
190 | 0 | return null_obj; |
191 | 0 | } |
192 | 132k | if (a->sp) { |
193 | 9.60k | auto const& iter = a->sp->elements.find(n); |
194 | 9.60k | return iter == a->sp->elements.end() ? null_obj : iter->second; |
195 | 9.60k | } |
196 | 122k | return n >= a->elements.size() ? null_obj : a->elements[n]; |
197 | 132k | } |
198 | | |
199 | | QPDFObjectHandle const& |
200 | | Array::operator[](int n) const |
201 | 132k | { |
202 | 132k | static const QPDFObjectHandle null_obj; |
203 | 132k | if (n < 0) { |
204 | 0 | return null_obj; |
205 | 0 | } |
206 | 132k | return (*this)[static_cast<size_t>(n)]; |
207 | 132k | } |
208 | | |
209 | | QPDFObjectHandle |
210 | | Array::get(size_t n) const |
211 | 587 | { |
212 | 587 | if (n >= size()) { |
213 | 0 | return {}; |
214 | 0 | } |
215 | 587 | auto a = array(); |
216 | 587 | if (!a->sp) { |
217 | 587 | return a->elements[n]; |
218 | 587 | } |
219 | 0 | auto const& iter = a->sp->elements.find(n); |
220 | 0 | return iter == a->sp->elements.end() ? null() : iter->second; |
221 | 587 | } |
222 | | |
223 | | QPDFObjectHandle |
224 | | Array::get(int n) const |
225 | 587 | { |
226 | 587 | if (n < 0) { |
227 | 0 | return {}; |
228 | 0 | } |
229 | 587 | return get(to_s(n)); |
230 | 587 | } |
231 | | |
232 | | std::vector<QPDFObjectHandle> |
233 | | Array::getAsVector() const |
234 | 18.7k | { |
235 | 18.7k | auto a = array(); |
236 | 18.7k | if (a->sp) { |
237 | 841 | std::vector<QPDFObjectHandle> v; |
238 | 841 | v.reserve(size()); |
239 | 359k | for (auto const& item: a->sp->elements) { |
240 | 359k | v.resize(item.first, null_oh); |
241 | 359k | v.emplace_back(item.second); |
242 | 359k | } |
243 | 841 | v.resize(size(), null_oh); |
244 | 841 | return v; |
245 | 17.8k | } else { |
246 | 17.8k | return a->elements; |
247 | 17.8k | } |
248 | 18.7k | } |
249 | | |
250 | | bool |
251 | | Array::set(size_t at, QPDFObjectHandle const& oh) |
252 | 0 | { |
253 | 0 | if (at >= size()) { |
254 | 0 | return false; |
255 | 0 | } |
256 | 0 | auto a = array(); |
257 | 0 | checkOwnership(oh); |
258 | 0 | if (a->sp) { |
259 | 0 | a->sp->elements[at] = oh; |
260 | 0 | } else { |
261 | 0 | a->elements[at] = oh; |
262 | 0 | } |
263 | 0 | return true; |
264 | 0 | } |
265 | | |
266 | | bool |
267 | | Array::set(int at, QPDFObjectHandle const& oh) |
268 | 0 | { |
269 | 0 | if (at < 0) { |
270 | 0 | return false; |
271 | 0 | } |
272 | 0 | return set(to_s(at), oh); |
273 | 0 | } |
274 | | |
275 | | void |
276 | | Array::setFromVector(std::vector<QPDFObjectHandle> const& v) |
277 | 0 | { |
278 | 0 | auto a = array(); |
279 | 0 | a->elements.resize(0); |
280 | 0 | a->elements.reserve(v.size()); |
281 | 0 | for (auto const& item: v) { |
282 | 0 | checkOwnership(item); |
283 | 0 | a->elements.emplace_back(item); |
284 | 0 | } |
285 | 0 | } |
286 | | |
287 | | bool |
288 | | Array::insert(size_t at, QPDFObjectHandle const& item) |
289 | 0 | { |
290 | 0 | auto a = array(); |
291 | 0 | size_t sz = size(); |
292 | 0 | if (at > sz) { |
293 | 0 | return false; |
294 | 0 | } |
295 | 0 | checkOwnership(item); |
296 | 0 | if (at == sz) { |
297 | | // As special case, also allow insert beyond the end |
298 | 0 | push_back(item); |
299 | 0 | return true; |
300 | 0 | } |
301 | 0 | if (!a->sp) { |
302 | 0 | a->elements.insert(a->elements.cbegin() + to_i(at), item); |
303 | 0 | return true; |
304 | 0 | } |
305 | 0 | auto iter = a->sp->elements.crbegin(); |
306 | 0 | while (iter != a->sp->elements.crend()) { |
307 | 0 | auto key = (iter++)->first; |
308 | 0 | if (key >= at) { |
309 | 0 | auto nh = a->sp->elements.extract(key); |
310 | 0 | ++nh.key(); |
311 | 0 | a->sp->elements.insert(std::move(nh)); |
312 | 0 | } else { |
313 | 0 | break; |
314 | 0 | } |
315 | 0 | } |
316 | 0 | a->sp->elements[at] = item; |
317 | 0 | ++a->sp->size; |
318 | 0 | return true; |
319 | 0 | } |
320 | | |
321 | | bool |
322 | | Array::insert(int at_i, QPDFObjectHandle const& item) |
323 | 0 | { |
324 | 0 | if (at_i < 0) { |
325 | 0 | return false; |
326 | 0 | } |
327 | 0 | return insert(to_s(at_i), item); |
328 | 0 | } |
329 | | |
330 | | void |
331 | | Array::push_back(QPDFObjectHandle const& item) |
332 | 0 | { |
333 | 0 | auto a = array(); |
334 | 0 | checkOwnership(item); |
335 | 0 | if (a->sp) { |
336 | 0 | a->sp->elements[(a->sp->size)++] = item; |
337 | 0 | } else { |
338 | 0 | a->elements.emplace_back(item); |
339 | 0 | } |
340 | 0 | } |
341 | | |
342 | | bool |
343 | | Array::erase(size_t at) |
344 | 353 | { |
345 | 353 | auto a = array(); |
346 | 353 | if (at >= size()) { |
347 | 14 | return false; |
348 | 14 | } |
349 | 339 | if (!a->sp) { |
350 | 293 | a->elements.erase(a->elements.cbegin() + to_i(at)); |
351 | 293 | return true; |
352 | 293 | } |
353 | 46 | auto end = a->sp->elements.end(); |
354 | 46 | if (auto iter = a->sp->elements.lower_bound(at); iter != end) { |
355 | 46 | if (iter->first == at) { |
356 | 46 | iter++; |
357 | 46 | a->sp->elements.erase(at); |
358 | 46 | } |
359 | | |
360 | 4.03k | while (iter != end) { |
361 | 3.98k | auto nh = a->sp->elements.extract(iter++); |
362 | 3.98k | --nh.key(); |
363 | 3.98k | a->sp->elements.insert(std::move(nh)); |
364 | 3.98k | } |
365 | 46 | } |
366 | 46 | --(a->sp->size); |
367 | 46 | return true; |
368 | 339 | } |
369 | | |
370 | | bool |
371 | | Array::erase(int at_i) |
372 | 353 | { |
373 | 353 | if (at_i < 0) { |
374 | 0 | return false; |
375 | 0 | } |
376 | 353 | return erase(to_s(at_i)); |
377 | 353 | } |
378 | | |
379 | | int |
380 | | QPDFObjectHandle::getArrayNItems() const |
381 | 138k | { |
382 | 138k | auto s = size(); |
383 | 138k | if (s > 1 || isArray()) { |
384 | 137k | return to_i(s); |
385 | 137k | } |
386 | 567 | typeWarning("array", "treating as empty"); |
387 | 567 | return 0; |
388 | 138k | } |
389 | | |
390 | | QPDFObjectHandle |
391 | | QPDFObjectHandle::getArrayItem(int n) const |
392 | 132k | { |
393 | 132k | if (auto array = Array(*this)) { |
394 | 132k | if (auto result = array[n]) { |
395 | 123k | return result; |
396 | 123k | } |
397 | 8.90k | if (n >= 0 && std::cmp_less(n, array.size())) { |
398 | | // sparse array null |
399 | 8.90k | return newNull(); |
400 | 8.90k | } |
401 | 4 | objectWarning("returning null for out of bounds array access"); |
402 | | |
403 | 74 | } else { |
404 | 74 | typeWarning("array", "returning null"); |
405 | 74 | } |
406 | 78 | static auto constexpr msg = " -> null returned from invalid array access"sv; |
407 | 78 | return QPDF_Null::create(obj, msg, ""); |
408 | 132k | } |
409 | | |
410 | | bool |
411 | | QPDFObjectHandle::isRectangle() const |
412 | 23.9k | { |
413 | 23.9k | Array array(*this); |
414 | 31.1k | for (auto const& oh: array) { |
415 | 31.1k | if (!oh.isNumber()) { |
416 | 526 | return false; |
417 | 526 | } |
418 | 31.1k | } |
419 | 23.3k | return array.size() == 4; |
420 | 23.9k | } |
421 | | |
422 | | bool |
423 | | QPDFObjectHandle::isMatrix() const |
424 | 0 | { |
425 | 0 | Array array(*this); |
426 | 0 | for (auto const& oh: array) { |
427 | 0 | if (!oh.isNumber()) { |
428 | 0 | return false; |
429 | 0 | } |
430 | 0 | } |
431 | 0 | return array.size() == 6; |
432 | 0 | } |
433 | | |
434 | | QPDFObjectHandle::Rectangle |
435 | | QPDFObjectHandle::getArrayAsRectangle() const |
436 | 0 | { |
437 | 0 | Array array(*this); |
438 | 0 | if (array.size() != 4) { |
439 | 0 | return {}; |
440 | 0 | } |
441 | 0 | std::array<double, 4> items; |
442 | 0 | for (size_t i = 0; i < 4; ++i) { |
443 | 0 | if (!array[i].getValueAsNumber(items[i])) { |
444 | 0 | return {}; |
445 | 0 | } |
446 | 0 | } |
447 | 0 | return { |
448 | 0 | std::min(items[0], items[2]), |
449 | 0 | std::min(items[1], items[3]), |
450 | 0 | std::max(items[0], items[2]), |
451 | 0 | std::max(items[1], items[3])}; |
452 | 0 | } |
453 | | |
454 | | QPDFObjectHandle::Matrix |
455 | | QPDFObjectHandle::getArrayAsMatrix() const |
456 | 0 | { |
457 | 0 | Array array(*this); |
458 | 0 | if (array.size() != 6) { |
459 | 0 | return {}; |
460 | 0 | } |
461 | 0 | std::array<double, 6> items; |
462 | 0 | for (size_t i = 0; i < 6; ++i) { |
463 | 0 | if (!array[i].getValueAsNumber(items[i])) { |
464 | 0 | return {}; |
465 | 0 | } |
466 | 0 | } |
467 | 0 | return {items[0], items[1], items[2], items[3], items[4], items[5]}; |
468 | 0 | } |
469 | | |
470 | | std::vector<QPDFObjectHandle> |
471 | | QPDFObjectHandle::getArrayAsVector() const |
472 | 17.9k | { |
473 | 17.9k | if (auto array = as_array(strict)) { |
474 | 17.9k | return array.getAsVector(); |
475 | 17.9k | } |
476 | 0 | typeWarning("array", "treating as empty"); |
477 | 0 | QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector"); |
478 | 0 | return {}; |
479 | 17.9k | } |
480 | | |
481 | | void |
482 | | QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const& item) |
483 | 0 | { |
484 | 0 | if (auto array = as_array(strict)) { |
485 | 0 | if (!array.set(n, item)) { |
486 | 0 | objectWarning("ignoring attempt to set out of bounds array item"); |
487 | 0 | } |
488 | 0 | } else { |
489 | 0 | typeWarning("array", "ignoring attempt to set item"); |
490 | 0 | } |
491 | 0 | } |
492 | | void |
493 | | QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items) |
494 | 0 | { |
495 | 0 | if (auto array = as_array(strict)) { |
496 | 0 | array.setFromVector(items); |
497 | 0 | } else { |
498 | 0 | typeWarning("array", "ignoring attempt to replace items"); |
499 | 0 | QTC::TC("qpdf", "QPDFObjectHandle array ignoring replace items"); |
500 | 0 | } |
501 | 0 | } |
502 | | |
503 | | void |
504 | | QPDFObjectHandle::insertItem(int at, QPDFObjectHandle const& item) |
505 | 0 | { |
506 | 0 | if (auto array = as_array(strict)) { |
507 | 0 | if (!array.insert(at, item)) { |
508 | 0 | objectWarning("ignoring attempt to insert out of bounds array item"); |
509 | 0 | QTC::TC("qpdf", "QPDFObjectHandle insert array bounds"); |
510 | 0 | } |
511 | 0 | } else { |
512 | 0 | typeWarning("array", "ignoring attempt to insert item"); |
513 | 0 | QTC::TC("qpdf", "QPDFObjectHandle array ignoring insert item"); |
514 | 0 | } |
515 | 0 | } |
516 | | |
517 | | QPDFObjectHandle |
518 | | QPDFObjectHandle::insertItemAndGetNew(int at, QPDFObjectHandle const& item) |
519 | 0 | { |
520 | 0 | insertItem(at, item); |
521 | 0 | return item; |
522 | 0 | } |
523 | | |
524 | | void |
525 | | QPDFObjectHandle::appendItem(QPDFObjectHandle const& item) |
526 | 0 | { |
527 | 0 | if (auto array = as_array(strict)) { |
528 | 0 | array.push_back(item); |
529 | 0 | } else { |
530 | 0 | typeWarning("array", "ignoring attempt to append item"); |
531 | 0 | QTC::TC("qpdf", "QPDFObjectHandle array ignoring append item"); |
532 | 0 | } |
533 | 0 | } |
534 | | |
535 | | QPDFObjectHandle |
536 | | QPDFObjectHandle::appendItemAndGetNew(QPDFObjectHandle const& item) |
537 | 0 | { |
538 | 0 | appendItem(item); |
539 | 0 | return item; |
540 | 0 | } |
541 | | |
542 | | void |
543 | | QPDFObjectHandle::eraseItem(int at) |
544 | 664 | { |
545 | 664 | if (auto array = as_array(strict)) { |
546 | 353 | if (!array.erase(at)) { |
547 | 14 | objectWarning("ignoring attempt to erase out of bounds array item"); |
548 | 14 | QTC::TC("qpdf", "QPDFObjectHandle erase array bounds"); |
549 | 14 | } |
550 | 353 | } else { |
551 | 311 | typeWarning("array", "ignoring attempt to erase item"); |
552 | 311 | QTC::TC("qpdf", "QPDFObjectHandle array ignoring erase item"); |
553 | 311 | } |
554 | 664 | } |
555 | | |
556 | | QPDFObjectHandle |
557 | | QPDFObjectHandle::eraseItemAndGetOld(int at) |
558 | 0 | { |
559 | 0 | auto result = Array(*this)[at]; |
560 | 0 | eraseItem(at); |
561 | 0 | return result ? result : newNull(); |
562 | 0 | } |
563 | | |
564 | | size_t |
565 | | BaseHandle::size() const |
566 | 187k | { |
567 | 187k | switch (resolved_type_code()) { |
568 | 145k | case ::ot_array: |
569 | 145k | return as<QPDF_Array>()->size(); |
570 | 0 | case ::ot_uninitialized: |
571 | 0 | case ::ot_reserved: |
572 | 39.6k | case ::ot_null: |
573 | 39.6k | case ::ot_destroyed: |
574 | 39.6k | case ::ot_unresolved: |
575 | 39.6k | case ::ot_reference: |
576 | 39.6k | return 0; |
577 | 7 | case ::ot_boolean: |
578 | 49 | case ::ot_integer: |
579 | 50 | case ::ot_real: |
580 | 158 | case ::ot_string: |
581 | 583 | case ::ot_name: |
582 | 1.80k | case ::ot_dictionary: |
583 | 1.80k | case ::ot_stream: |
584 | 1.80k | case ::ot_inlineimage: |
585 | 1.80k | case ::ot_operator: |
586 | 1.80k | return 1; |
587 | 0 | default: |
588 | 0 | throw std::logic_error("Unexpected type code in size"); // unreachable |
589 | 0 | return 0; // unreachable |
590 | 187k | } |
591 | 187k | } |
592 | | |
593 | | QPDFObjectHandle |
594 | | BaseHandle::operator[](size_t n) const |
595 | 0 | { |
596 | 0 | if (resolved_type_code() == ::ot_array) { |
597 | 0 | return Array(obj)[n]; |
598 | 0 | } |
599 | 0 | if (n < size()) { |
600 | 0 | return *this; |
601 | 0 | } |
602 | 0 | return {}; |
603 | 0 | } |
604 | | |
605 | | QPDFObjectHandle |
606 | | BaseHandle::operator[](int n) const |
607 | 0 | { |
608 | 0 | if (n < 0) { |
609 | 0 | return {}; |
610 | 0 | } |
611 | 0 | return (*this)[static_cast<size_t>(n)]; |
612 | 0 | } |