Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where is class std::out_of_range fully defined?

Tags:

c++

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?

like image 876
ROTOGG Avatar asked Jul 24 '13 02:07

ROTOGG


2 Answers

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.

like image 121
Mikael Persson Avatar answered Oct 08 '22 16:10

Mikael Persson


std::out_of_range is fully defined in §19.2.5 Class out_of_range [out.of.range] of the C++11 standard.

like image 34
Casey Avatar answered Oct 08 '22 17:10

Casey