From 0ab40dc1ab4e689921da54080b135e1d22b1c586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 14 Mar 2017 21:45:23 +0100 Subject: Refactoring louloulibs and cmake Use OBJECT libraries Remove the louloulibs directory Write FOUND variables in the cache --- src/utils/split.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/utils/split.cpp (limited to 'src/utils/split.cpp') diff --git a/src/utils/split.cpp b/src/utils/split.cpp new file mode 100644 index 0000000..80f8dae --- /dev/null +++ b/src/utils/split.cpp @@ -0,0 +1,19 @@ +#include +#include + +namespace utils +{ + std::vector split(const std::string& s, const char delim, const bool allow_empty) + { + std::vector ret; + std::stringstream ss(s); + std::string item; + while (std::getline(ss, item, delim)) + { + if (item.empty() && !allow_empty) + continue ; + ret.emplace_back(std::move(item)); + } + return ret; + } +} -- cgit v1.2.3