I'm developing a game engine, and set up a function that uses string streams to convert various values into std::string's. To use this to string function on class obviously takes an overloaded insertion operator, which I have done for a transformation matrix class here:
typedef std::stringstream StreamString;
StringStream& operator<<(StringStream& stream, const TransMatrix& matrix)
{
for (int y = 0; y < 4; y++)
{
stream << "{ ";
for (int x = 0; x < 4; x++)
{
stream << matrix(x, y) << ((x < 3) ? ", " : " }\n");
};
};
return stream;
};
I'm using Visual Studio C++ 2010 (which is probably my first mistake). The error I'm getting is " stream << "{ "; ". The compiler says that there are a bunch multiple overloads that fit that definition, including
std::basic_ostream<_Elem,_Traits> std::basic_ostream<_Elem,_Traits>::operator<<(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))
std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator<<(std::_Bool)
std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator<<(const void *)
and more or less every definition of the << operator for string stream. However, it doesn't include one for const char*, which is obviously the one I want. What's more is this code worked exactly as expected for a while, but suddenly stopped. I don't remember changing anything that would have affected this, but maybe I'm wrong.
Anyways, anybody have any advice?