Reputation: 1136
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?
Upvotes: 6
Views: 1173
Reputation: 9811
here you go
http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-3.4/stdexcept_8cc-source.html
keep in mind that libstdc++ is no longer distributed as a single library, but the source of the library is actually bundled with gcc, so to download libstdc++ you have to download gcc.
Upvotes: 0
Reputation: 42574
std::out_of_range
is fully defined in §19.2.5 Class out_of_range
[out.of.range] of the C++11 standard.
Upvotes: 1
Reputation: 18572
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.
Upvotes: 3
Reputation: 93880
Those are in libstdc++
which is built as part of gcc
. You can download gcc-core-X.Y.Z.tar.bz2
and find it there.
Upvotes: 0