26 #include <boost/lexical_cast.hpp>
37 const std::string& splitBy,
38 bool trimElements =
false,
39 bool removeEmptyElements =
false)
43 return std::vector<T>();
46 std::vector<std::string> components =
47 Split(
source, splitBy, trimElements, removeEmptyElements);
50 std::vector<T> result(components.size());
54 boost::lexical_cast<T, std::string>);
63 template <std::size_t... Is>
66 template <
class... Ts>
68 Format(
const std::string& form,
const std::tuple<Ts...>& tuple)
71 #pragma GCC diagnostic push
72 #pragma GCC diagnostic ignored "-Wformat-security"
74 int sz = std::snprintf(buff,
sizeof(buff), form.c_str(), std::get<Is>(tuple)...);
75 if (0 < sz &&
static_cast<std::size_t
>(sz) <
sizeof(buff))
79 std::vector<char> buffd(sz + 1);
80 if (std::snprintf(buff,
sizeof(buff), form.c_str(), std::get<Is>(tuple)...) != sz)
83 " std::snprintf behaved unexpectedly"};
85 #pragma GCC diagnostic pop
90 Format(
const std::string& form, std::tuple<>)
98 template <std::size_t From, std::size_t To,
class... Ts>
105 template <std::size_t From,
class... Ts>
112 template <
class... Ts>
116 return TupleToStringF<0>(form, tuple);