[Dev-C++] String << operator overloaded (using template)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: David M. <ci...@ya...> - 2003-07-13 18:02:28
|
Could someone tell me why the following code does not work?
//Allows the use of << on any data type that has it defined
//into a string.
template <class in_type>
std::string& operator<< (std::string& output, in_type& data)
{
std::stringstream ss;
ss << data;
ss >> output;
return output;
}
---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo. |