y3c-stl 0.4.0
Friendly C++ STL wrapper with automatic stacktrace
Loading...
Searching...
No Matches
array-iter.cc

‍example output:

y3c-stl terminated: undefined behavior detected (ub_iter_after_end)
at y3c::array<int, 5>::iterator::operator+=(): iterated over the end() of container.
Stack trace (most recent call first):
#0 0x0000000000004778 in main at /home/runner/work/y3c-stl/y3c-stl/build/../examples/array-iter.cc:7:11
5: y3c::array<int, 5> a = {1, 2, 3, 4, 5};
6: y3c::array<int, 5>::iterator it = a.begin();
7: it += 10;
8: std::cout << *it << std::endl;
9: }
#1 0x0000000000029d8f at /lib/x86_64-linux-gnu/libc.so.6
#2 0x0000000000029e3f in __libc_start_main at /lib/x86_64-linux-gnu/libc.so.6
#3 0x0000000000004604 in _start at /home/runner/work/y3c-stl/y3c-stl/build/examples/y3c-example-array-iter
array, vector など各種コンテナのイテレータ
Definition iterator.h:26
contiguous_iterator & operator+=(std::ptrdiff_t n)
Definition iterator.h:156
Definition array.h:8
#include <y3c/array>
#include <iostream>
int main() {
y3c::array<int, 5> a = {1, 2, 3, 4, 5};
it += 10;
std::cout << *it << std::endl;
}
固定長配列 (std::array)
Definition array.h:20
iterator begin()
先頭要素を指すイテレータを取得
Definition array.h:270