example output:
catch as std::out_of_range, what(): attempted to access index 100, that is outside the bounds of size 1.
catch as std::logic_error, what(): attempted to access index 100, that is outside the bounds of size 1.
catch as std::exception, what(): attempted to access index 100, that is outside the bounds of size 1.
catch anything
#include <y3c/array>
#include <iostream>
int main() {
try {
} catch (const std::out_of_range &e) {
std::cout << "catch as std::out_of_range, what(): " << e.what()
<< std::endl;
}
try {
} catch (const std::logic_error &e) {
std::cout << "catch as std::logic_error, what(): " << e.what()
<< std::endl;
}
try {
} catch (const std::exception &e) {
std::cout << "catch as std::exception, what(): " << e.what()
<< std::endl;
}
try {
} catch (...) {
std::cout << "catch anything" << std::endl;
}
}
固定長配列 (std::array)
Definition array.h:20
reference at(size_type n, internal::skip_trace_tag={})
要素アクセス
Definition array.h:133