When writing an overload for the iostream << operator, particularly on an application class, it may be desirable to alter the behavior of that overload based on the standard manipulators in effect on that stream object. Can the state of standard manipulators of a stream be polled from within implementations of << overloads?
For example it might be desirable for
std::cout << std::internal << myClassReference;
to behave differently than
std::cout << std::left << myClassReference;
beyond the differences the custom overload of << may be handing off to member <<'s in its implementation.
If the manipulator state of an iostream can be polled, how is this accomplished? Also what should someone implementing custom manipulators do so that the state of their manipulators can likewise be polled?