#include <ctime>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <utility>

struct make_string
{
    make_string & operator<<(std::ostream& (*manip)(std::ostream&))
    {
        manip(ostr);
        return *this;
    }
    
    template <typename T> make_string & operator<<(const T & t)
    {
        ostr << t;
        return *this;
    }

    operator std::string() const { return ostr.str(); }

    std::string str() const { return ostr.str(); }
    
    std::ostringstream ostr;
};


void message(const std::string&) {}

int main()
{
    message(make_string() << "1 + 1 = " << 2 << "\n"); // OK
    message(make_string() << "1 + 1 = " << 2 << std::endl); // Not OK
    
    
    // OK
    std::ostringstream os;
    os << std::endl;
    
    // Not ok.
    make_string mk;
    mk << std::endl;
}