Multiline ustring operations with Glib (in stream)

Interesting, can I make same construction but, by using Glib / ustring API?

    #include <sstream>

    std::istringstream stream(subject);
    std::string line;
    while (std::getline(stream, line)) {
        std::cout<<line<<std::endl;
    }

I guess you can do something like this:

    std::locale::global(std::locale(""));
    auto ustring_getline = [](std::istream& stream, Glib::ustring& uline) -> std::istream& {
        std::string line;
        std::getline(stream, line);
        uline = Glib::locale_to_utf8(line); // may throw Glib::ConvertError
        return stream;
    };

    for (Glib::ustring line; ustring_getline(std::cin, line);) {
        std::cout << line << std::endl;
    }

If you’re not actually dealing with system locale input you wouldn’t use Glib::locale_to_utf8() tho. If you know its utf8 you can simply uline = line