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

‍example output:

4
y3c-stl terminated: undefined behavior detected (ub_access_deleted)
at y3c::wrap<int*>::operator*(): attempted to access the deleted value.
Stack trace (most recent call first):
#0 0x00000000000047ae in main at /home/runner/work/y3c-stl/y3c-stl/build/../examples/array-ptr-local.cc:11:18
9: std::cout << *p << std::endl;
10: }
11: std::cout << *p << std::endl;
12: }
#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 0x0000000000004564 in _start at /home/runner/work/y3c-stl/y3c-stl/build/examples/y3c-example-array-ptr-local
値型wrap: base_type型のデータと、このデータの生存状態を管理するクラス
Definition wrap.h:26
Definition array.h:8
#include <y3c/array>
#include <iostream>
int main() {
{
y3c::array<int, 5> a = {1, 2, 3, 4, 5};
p = &a[3];
std::cout << *p << std::endl;
}
std::cout << *p << std::endl;
}
固定長配列 (std::array)
Definition array.h:20
ポインタ型wrap: element_type型のデータへのポインタと、 このポインタ自体の生存状態を管理するクラス
Definition wrap.h:318