Template stream operator overloading
I want to be able to put the template class below in a cin and cout and thereby be able to input/output the value contained within. Has anyone done this before and know how it could be done?
Code:
template<class T> SomeClass
{
public:
SomeClass(T inval) { value = inval; }
protected:
T value;
}
Example of what I want to be able to do:
Code:
SomeClass someObject<int>(5);
cout << someObject << endl;
When run, I want this code to output '5'. Thanks
Intel Core Duo Macbook w/ Mac OS 10.5.6
gcc 4.2.1 (i386-apple-darwin9.1.0) and Xcode 3.1.1