<string>ヘッダにあるstd::getline()関数は、行単位の読み取りだけでなく、区切り文字を指定するバージョンもあるので、splitの実装に使えたりする。 #include <iostream> #include <string> #include <sstream> #include <vector> std::vector<std::string> split(const std::string& input, char delimiter) { std::istringstream stream(input); std::string field; std::vector<std::string> result; while (std::getline(stream, field, delimiter)) { result.push_back(field); } retu