I would like to create a custom facet that applies to all streamed text output, and access the operated-on stream's internal extensible array (i.e. via iword).
If I were only interested in having the custom string manipulator operate on numbers, I could do something like what's described here: C++ custom stream manipulator that changes next item on stream
If I didn't need access to the iosbase, I could use codecvt's do_out method, as is described here: How to easily indent output to ofstream?, but I don't have access to the stream's ios_base within the codecvt facet (as far as I can tell).
Is there a way to define a custom facet that will be called on all stream output, as is the case with codecvt, but where I have access to ios_base& as is the case with num_put? Is there a way I can access the stream the codecvt facet is currently being applied to?