Listing 9

#include <cctype>                          // toupper
#include <boost/iostreams/concepts.hpp>    // input_filter
#include <boost/iostreams/operations.hpp>  // get()

struct to_upper_filter : boost::iostreams::input_filter {
    template<typename Source>
    int get(Source& src)
    {
        return std::toupper((unsigned char) boost::iostreams::get(src));
    }
};