I am searching under /usr/include/c++
on my Ubuntu Linux. In /usr/include/c++/stdexcept
, I found this:
class out_of_range : public logic_error
{
public:
explicit out_of_range(const string& __arg);
};
But I can't find anywhere the definition of out_of_range()
constructors.
Also when the STL throws an out_of_range()
exception, it uses (example taken from stl_vector.h
):
__throw_out_of_range(__N("vector::_M_range_check"));
And, the only thing I can find for __throw_out_of_range()
is:
void __throw_out_of_range(const char*) __attribute__((__noreturn__));
Can you kindly point me to where the definitions of the out_of_range
class?
They're probably defined in libstdc++
. You can get the source code on the GCC website. On Ubuntu distros, you just have the library installed (libstdc++.so
), not the source code. The stuff you found are just the declarations, not the definitions.
std::out_of_range
is fully defined in §19.2.5 Class out_of_range
[out.of.range] of the C++11 standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With