according to cplusplus.com on std::bad_alloc
Type of the exceptions thrown by the standard definitions of operator new and operator new[] when they fail to allocate the requested storage space.
However, in my code the new operator is not used:
#include <iostream>
#include <boost/filesystem.hpp>
#include <cstdint>
using namespace std;
using namespace boost::filesystem;
int main()
{
path p{};
std::cin >> p;
if (exists(p)) // does p actually exist?
{
if (is_regular_file(p)) // is p a regular file?
cout << p << " size is " << file_size(p) << '\n';
else if (is_directory(p)) // is p a directory?
cout << p << "is a directory\n";
else
cout << p << "exists, but is neither a regular file nor a directory\n";
}
else
cout << p << "does not exist\n";
return 0;
}
(code taken from boost filesystem tutorial)
and yet the console says:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)