Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

2018-10-25から1日間の記事一覧

boostのforeach文とsplitで改行等特定シンボル毎にリスト化する

cpp

for文よりスマートに記述できるケースも 実際のところ #include <boost/algorithm/string.hpp> #include <string> #include <list> #include <iostream> #include <boost/foreach.hpp> using namespace std; int main() { string str ("1,2\n3,4\n5,6"); string delim ("\n"); list<string> list_string; boost::split(list_string, str, boos</string></boost/foreach.hpp></iostream></list></string></boost/algorithm/string.hpp>…