Ok, so I have this code:

Code:
template <typename Iter, typename Ins>
bit8_to_ASCII (Iter begin, Iter end, Ins output) {
   // Need this vector to hold intermediate values.
   std::vector<unsigned char> bit6;

   // Stretch the 8-bit values out to 6-bit values, store the result in vector bit6.
   bit8_to_bit6 (begin, end, std::back_inserter(bit6));

   // Translate the 6-bit values into ASCII values.  Store the output in the
   //   output stream.
   std::transform (bit6.begin(), bit6.end(), output, bit6_to_ASCII);

   return;
}
Conceptually... vector bit6 is really not needed. It's just an artifact of the problem that I can't start std::transform until after the bit8_to_bit6 function is done. Is there some kind of inserter-wrapper I can use to take it out of the picture? Something like this maybe:

Code:
template <typename Iter, typename Ins>
bit8_to_ASCII (Iter begin, Iter end, Ins output) {
   // No need to allocate an intermediate vector

   // Whenever something is output to transforming_inserter, it calls bit6_to_ASCII
   //   on the input, and stores the result in output.
   SOME_TYPE transforming_inserter = SOME_FUNCTION(output, bit6_to_ASCII);

   // Stretch the 8-bit values out to 6-bit values, store the result in 
   //   the custom inserter which will perform bit6_to_ASCII on the fly.
   bit8_to_bit6 (begin, end, transforming_inserter);

   return;
}