C++0x und tuple: iostream-Manipulation?



  • Hoi,

    boost::tuple erlaubt ja das Manipulieren von outstreams in etwa so:

    #include <iostream>
    #include <fstream>
    #include <iomanip>
    
    #include <boost/tuple/tuple.hpp>
    #include <boost/tuple/tuple_io.hpp>
    ...
    using namespace boost;
    
    boost::tuple<double, double> my_tuple(3.14159;2.7182);
    
    std::ofstream outfile(("foo.txt").c_str());
    
    outfile << boost::tuples::set_open('[') << boost::tuples::set_close(']')
            << boost::tuples::set_delimiter(',') << std::setw(15)
            << std::setprecision(2)
            << my_tuple;
    

    Ggf. fehlerhaft, habe ich jetzt nicht gecheckt, aber ich hoffe es ist klar, wenn ich frage: Kann man in c++0x eine vergleichbare Streamformatierung unternehmen? Ich habe bislang keine aussagekräftige Dokumentation gefunden.

    Gruß,
    Christian


Anmelden zum Antworten