#ifndef UTIL_H_E9110D4C #define UTIL_H_E9110D4C #include #include template void erase_if(Container& items, const Predicate& predicate) { for (auto it = std::begin(items); it != std::end(items);) { if (predicate(*it)) { it = items.erase(it); } else { ++it; } } }; template void splitStr( std::string input, std::string delimiter, OutputIterator out) { while (!input.empty()) { int divider = input.find(delimiter); if (divider == std::string::npos) { *out = input; out++; input = ""; } else { *out = input.substr(0, divider); out++; input = input.substr(divider+delimiter.length()); } } } template Container splitStr( std::string input, std::string delimiter) { Container result; splitStr(input, delimiter, std::back_inserter(result)); return result; } #endif /* end of include guard: UTIL_H_E9110D4C */