29 #ifndef LIB_FORMAT_UTIL_H 30 #define LIB_FORMAT_UTIL_H 62 template<
class CON,
typename X,
typename...ELMS>
64 do_stringify(CON& container, X
const& elm, ELMS
const& ...args)
67 do_stringify (container, args...);
71 template<
class CON,
typename...ELMS>
76 operator+= (
string&& s)
78 CON::push_back (move(s));
85 template<
typename X,
typename...ELMS>
91 this->reserve(
sizeof...(ELMS));
95 operator+= (
string&& s)
97 this->emplace_back (move(s));
109 template<
class CON,
typename...ELMS>
113 SeqContainer<CON,ELMS...> storage;
114 do_stringify (storage, elms...);
115 return CON {move(storage)};
119 template<
typename...ELMS>
120 inline vector<string>
123 return collectStr<vector<string>> (elms...);
135 using Val =
typename lib::meta::ValueTypeBinding<IT>::value_type;
143 template<
class CON,
typename TOGGLE =
void>
146 using StlIter =
typename CON::const_iterator;
151 : iter(begin(collection), end(collection))
161 : iter(std::forward<IT>(srcIter))
193 join (CON&& coll,
string const& delim =
", ")
195 using Coll =
typename lib::meta::Strip<CON>::TypePlain;
196 _RangeIter<Coll> range(std::forward<CON>(coll));
198 auto strings =
stringify (std::move (range.iter));
199 if (!strings)
return "";
201 std::ostringstream buffer;
202 for ( ; strings; ++strings)
203 buffer << *strings << delim;
206 size_t len = buffer.str().length();
207 ASSERT (len >= delim.length());
208 return buffer.str().substr(0, len - delim.length());
213 join (std::initializer_list<X>
const&& ili,
string const& delim =
", ")
215 return join (ili, delim);
221 template<
typename...ARGS>
229 template<
typename...ARGS>
237 template<
typename...ARGS>
Implementation namespace for support and library code.
Marker types to indicate a literal string and a Symbol.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Helpers for type detection, type rewriting and metaprogramming.
auto collection(COLL &coll)
Entry point to a nested DSL for setup and configuration of a collection binding.
auto transformIterator(IT const &src, FUN processingFunc)
Build a TransformIter: convenience free function shortcut, picking up the involved types automaticall...