2010-09-26から1日間の記事一覧

pstade::oven::stream_lines

\(^o^)/ #include <iostream> #include <fstream> #include <string> #include <boost/range/algorithm/for_each.hpp> #include <pstade/oven/stream_lines.hpp> int main(){ namespace oven = pstade::oven; std::ifstream ifs("test.txt"); boost::for_each(oven::stream_lines(ifs), [](std::string line){ std::cout <<…</pstade/oven/stream_lines.hpp></boost/range/algorithm/for_each.hpp></string></fstream></iostream>

std::ifstream の range

テキストファイルの行単位での範囲を取得するとかそんな感じ。 #include <iostream> #include <fstream> #include <string> #define BOOST_FILESYSTEM_VERSION 3 #include <boost/range.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/range/algorithm/for_each.hpp> #include <boost/lexical_cast.hpp>…</boost/lexical_cast.hpp></boost/range/algorithm/for_each.hpp></boost/filesystem/fstream.hpp></boost/filesystem.hpp></boost/range.hpp></string></fstream></iostream>