Real-Life examples:

Writing a generic version of the Ziv-Lempel compression algorithm, and used to independently specialize the encoding (to code/decode LZ77, LZH, LZW, GIF and other formats) and tune the implementation (optimizing encode table caching)