| Home | Libraries | People | FAQ | More

#### Design Rationale

- The flags are implemented as a const data member of the facet. Facets are reference counted, and locales can share facets. Therefore changing the flags of a facet would have effects that are hard to predict. An alternative design would be to implement the flags using `std::ios_base::xalloc` and `std::ios_base::iword`. Then one could safely modify the flags, and one could define manipulators that do so. However, for that to work with dynamically linked libraries, a `.cpp` file would have to be added to the library. It was judged be more desirable to have a headers only library, than to have mutable flags and manipulators.
- The facet `nonfinite_num_put` throws an exception when the `trap_infinity` or `trap_nan` flag is set and an attempt is made to format infinity or NaN. It would be better if the facet set the fail bit of the stream. However, facets derived from `std::num_put` do not have access to the stream state.