D
David W
A colleague wants to do this with a std:stream:
os << fahrenheit << 37.0;
This would output 98.6 (i.e., Celsius --> Fahrenheit).
I've already suggested os << fahrenheit(37.0), but he doesn't like it.
Then he suggested that the function taking the stream and fahrenheit manipulator
could return an instance of another user-defined type, to which the 37.0 is then
passed to do the conversion and output. This would work, but you might want to
pass something else, such as another manipulator, before the value (use a
catch-all member template maybe?).
Any other ideas?
DW
os << fahrenheit << 37.0;
This would output 98.6 (i.e., Celsius --> Fahrenheit).
I've already suggested os << fahrenheit(37.0), but he doesn't like it.
Then he suggested that the function taking the stream and fahrenheit manipulator
could return an instance of another user-defined type, to which the 37.0 is then
passed to do the conversion and output. This would work, but you might want to
pass something else, such as another manipulator, before the value (use a
catch-all member template maybe?).
Any other ideas?
DW