Search code examples
c++language-lawyerstandardsstickyiomanip

Is There an Official Resource for Sticky Manipulators


Does the standard define which iomanip manipulators are sticky and which are not?

I keep finding myself referring to: https://stackoverflow.com/a/1533222/2642059

Which, is a great answer, but even says:

on my version

This coupled with the fact that I cannot find the concept of sticky on http://en.cppreference.com or http://www.cplusplus.com leads me to wonder whether this is an implementation defined concept.


Solution

  • Not "official", but cppreference.com says, in std::setw

    The width property of the stream will be reset to zero (meaning "unspecified") if any of the following functions are called:

    As the edit history in cppreference says, this list was compiled by grepping the standard draft for "width"

    All other manipulators are "sticky", as in, the stream state changes they perform persist until explicitly changed again.