fix(core): do not add functions to std namespace
Description
We explicitly a function to the std
namespace in some places:
-
libs/core/core/Type.hpp
/.cpp
-
sight/libs/core/utestData/File.cpp
: using namespace std; sight/utils/sightrun/src/ProfileRunner.cpp
It is undefined behaviour to add declarations or definitions to namespace std or to any namespace nested within std, with a few exceptions noted below.
And our case does not fall into those exceptions. Sight has undefined behaviour globally.
Steps to reproduce
Open one of those files.
Proposal
-
Type
should provide:
inline friend std::ostream& operator<<(std::ostream& out, const Type& t)
{
return out << t.name();
}
Or the header should define an equivalent free function.
-
ProfileRunner.cpp
should just use free functions.
Functional specifications
Same as before.
Technical specifications
Replace those functions by friend
functions in in classes when possible, or by free functions in the same space those are called.
Test plan
Compiles, runs fine. Test passes.