Do invocations of std constructors need to be qualified?
c++, constructor, exception, inheritance, namespaces
Solution
No you don't. The names in the initializer list are looked up in the scope of the `whatever` class. This class scope includes names declared in base classes and the name of the base class (`runtime_error`) is inserted into the scope of `std::runtime_error` (this is standard behaviour for all classes).
Note that this doesn't work if the name that you use is a `typedef` for the actual class name. You can easily be tempted with, e.g., `std::istream` and friends. See here.
Problem
Do invocations of `std` constructors need to be qualified with `std::`? ``` class whatever : public std::runtime_error { public: explicit whatever(const std::string& what) : runtime_error(what) {} }; // ^ do I need std:: here? ``` It works on my compiler without the qualification, but I'm not sure whether that behavior is standard.