I have a very interesting problem with compiling a short little program on a Mac (GCC 4.2). The function below would only stream chars or strings into the stringstream, but not anything else (int, double, float, etc.) In fact, the fail flag is set if I attempt to convert for example an int into a string.
However, removing the preprocessor flag: _GLIBCXX_DEBUG=1
, which is set by default in XCode for the debug mode, will yield the desired results / correct behavior.
Here is the simple function I am talking about. value is template variable of type T. Tested for int, double, float (not working), char and strings (working).
template < typename T >
const std::string Attribute<T>::getValueAsString() const
{
std::ostringstream stringValue;
stringValue << value;
return stringValue.str();
}
Any ideas what I am doing wrong, why this doesn't work, or what the preprocessor flag does to make this not work anymore?
Thanks!