y3c-stl 0.3.3
Friendly C++ STL wrapper with automatic stacktrace
Loading...
Searching...
No Matches
vector-operator.cc

‍example output:

y3c-stl terminated: undefined behavior detected (ub_out_of_range)
at y3c::vector<int>::operator[](): attempted to access index 100, that is outside the bounds of size 5.
Stack trace (most recent call first):
#0 0x000055ab21d79670 in main at /home/runner/work/y3c-stl/y3c-stl/build/../examples/vector-operator.cc:5:14
3: int main() {
4: y3c::vector<int> a = {1, 2, 3, 4, 5};
5: a[100] = 42;
6: }
可変長配列 (std::vector)
Definition vector.h:23
reference operator[](size_type n)
要素アクセス
Definition vector.h:566
Definition array.h:8
#include <y3c/vector>
int main() {
y3c::vector<int> a = {1, 2, 3, 4, 5};
a[100] = 42;
}