According to this reference for operator new:
Global dynamic storage operator functions are special in the standard library:
- Al
The C++ Standard verse 3.7.4.2 says :-
The library provides default definitions for the global allocation and deallocation functions. Some global allocation and deallocation functions are replaceable (18.6.1). A C++ program shall provide at most one definition of a replaceable allocation or deallocation function. Any such function definition replaces the default version provided in the library (17.6.3.6). The following allocation and deallocation functions (18.6) are implicitly declared in global scope in each translation unit of a program.
void* operator new(std::size_t) throw(std::bad_alloc);
void* operator new[](std::size_t) throw std::bad_alloc);
void operator delete(void*) throw();
void operator delete[](void*) throw();
These implicit declarations introduce only the function names
operator new,operator new[],operator delete,operator delete[]. [ Note: the implicit declarations do not introduce the namesstd,std::bad_alloc, andstd::size_t, or any other names that the library uses to declare these names. Thus, a new-expression, delete-expression or function call that refers to one of these functions without including the headeris well-formed. However, referring tostd,std::bad_alloc, andstd::size_tis ill-formed unless the name has been declared by including the appropriate header. —end note]
Also, the std::nothrow version of the operator new requires the inclusion of the header (example).
The standard though does not specify implicit inclusion of the header files within other header files. So it is safe and portable to follow the standard when the names std::bad_alloc etc are referred.