I'm not a big user of streams myself, so I'll only list what I think about them. This is really subjective, I'll understand if my answer is voted for deletion.
I may have a enum
, a class
or anything else, making my user defined type printable is always done by providing the same operator<<
next to my type :
std::ostream &operator<<(std::ostream &, const MyType &);
You may ask yourself if a type is printable, but never how it is printable.
Obviously, it is incredibly easy to provide 'streaming capacities' to a user defined type. It's also a great to be able to provide our own implementation of a stream and have it fit transparently in an existing code. Once your operator<<
are appropriately defined, writing to standard output, a memory buffer or a file is trivially changeable.
I've always thought iomanip
to be a mess. I hate writing things such as (I'm just throwing random manipulators here) :
std::cout << std::left << std::fixed << std::setprecision(0) << f << std::endl;
I think it was much easier with printf
, but Boost.Format is helpful here.