| 711 | |
| 712 | template<class T> |
| 713 | static std::vector<T> string_split(const std::string & str, char delim) { |
| 714 | static_assert(!std::is_same<T, std::string>::value, "Please use the specialized version for std::string"); |
| 715 | std::vector<T> values; |
| 716 | std::istringstream str_stream(str); |
| 717 | std::string token; |
| 718 | while (std::getline(str_stream, token, delim)) { |
| 719 | T value; |
| 720 | std::istringstream token_stream(token); |
| 721 | token_stream >> value; |
| 722 | values.push_back(value); |
| 723 | } |
| 724 | return values; |
| 725 | } |
| 726 | |
| 727 | template<> |
| 728 | inline std::vector<std::string> string_split<std::string>(const std::string & str, char delim) |