B
bart.kowalski
Hello,
I'm trying to overload operator << for class CString, which has an
operator const char *. I thought the following code would do:
template <typename T>
inline std::basic_ostream<T> operator<<(
const std::basic_ostream<T>& p_Stream,
const CString& p_String)
{
p_Stream << static_cast<const T*>(p_String) << std::flush;
return p_Stream;
}
But instead the operator calls itself recursively ad-infinitum. Can
someone explain why?
Bart.
I'm trying to overload operator << for class CString, which has an
operator const char *. I thought the following code would do:
template <typename T>
inline std::basic_ostream<T> operator<<(
const std::basic_ostream<T>& p_Stream,
const CString& p_String)
{
p_Stream << static_cast<const T*>(p_String) << std::flush;
return p_Stream;
}
But instead the operator calls itself recursively ad-infinitum. Can
someone explain why?
Bart.