Why GCC implementation of std::vector operator[] has noexcept specifier

Viewed 51

Here - https://en.cppreference.com/w/cpp/container/vector/operator_at it says that operator[] has no noexcept specifier. But If I write:

cout << noexcept(declval<vector<float>>()[declval<size_t>()]) << endl;

I get:

true

Compiled with g++.exe (Rev2, Built by MSYS2 project) 11.2.0. Compilation flags: -std=c++20 -pedantic.

0 Answers
Related