Add make_unique.hpp and split.hpp

This commit is contained in:
Florent Le Coz
2013-11-06 21:01:18 +01:00
parent bf7b05ef72
commit 4b76a30d04
2 changed files with 99 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#ifndef SPLIT_INCLUDED
# define SPLIT_INCLUDED
#include <string>
#include <sstream>
#include <vector>
namespace utils
{
std::vector<std::string> split(const std::string &s, const char delim)
{
std::vector<std::string> ret;
std::stringstream ss(s);
std::string item;
while (std::getline(ss, item, delim))
ret.emplace_back(std::move(item));
return ret;
}
}
#endif // SPLIT_INCLUDED