#define _GLIBCXX_DEBUG 1 #define _GLIBCXX_DEBUG_PEDANTIC 1 #define _FORTIFY_SOURCE 2 #include <bits/stdc++.h> int main() { std::vector<int> arr(3,1); std::cout << arr[3]; }
Standard input is empty
Standard output is empty
/usr/include/c++/8/debug/vector:417: Error: attempt to subscript container with out-of-bounds index 3, but container only holds 3 elements. Objects involved in the operation: sequence "this" @ 0x0x7ffd56db0600 { type = std::__debug::vector<int, std::allocator<int> >; }