2017-08-15から1日間の記事一覧

C++ で std::regex を使った split

C++

C++ で split が話題になっていたのでやってみた。 #include <regex> #include <iostream> #include <string> #include <vector> int main(){ auto split = [](std::string src, auto pat){ std::vector<std::string> result{}; std::regex reg{pat}; std::copy( std::sregex_token_iterator{src.begin(), s</std::string></vector></string></iostream></regex>…