ios_base::setf

void setf(fmtflags mask);
fmtflags setf(fmtflags fmtfl, fmtflags mask);

The first member function effectively calls flags(mask | flags()) (set selected bits), then returns the previous format flags. The second member function effectively calls flags(mask & fmtfl, flags() & ~mask) (replace selected bits under a mask), then returns the previous format flags.