What does the C++ standard have to say about overloading/implementing a templatized version of std::to_string
like so:
#include <string>
#include <sstream>
#include <ostream>
namespace std {
template<typename T>
string to_string(const T& in)
{
ostringstream oss;
oss << in;
return oss.str();
}
}
Is this expressedly disallowed? Or cause nasal-daemons to fly out of the nose?
g++ accepts the above code with --std=c++11 -Wextra -pedantic-errors
, reports no errors, and the executable generates the output that I expect (which, of course, does not mean anything in context to my question)
7