38 #ifndef LIB_FORMAT_UTIL_H 39 #define LIB_FORMAT_UTIL_H 71 template<
class CON,
typename X,
typename...ELMS>
73 do_stringify(CON& container, X
const& elm, ELMS
const& ...args)
76 do_stringify (container, args...);
80 template<
class CON,
typename...ELMS>
85 operator+= (
string&& s)
87 CON::push_back (move(s));
94 template<
typename X,
typename...ELMS>
100 this->reserve(
sizeof...(ELMS));
104 operator+= (
string&& s)
106 this->emplace_back (move(s));
118 template<
class CON,
typename...ELMS>
122 SeqContainer<CON,ELMS...> storage;
123 do_stringify (storage, elms...);
124 return CON {move(storage)};
128 template<
typename...ELMS>
129 inline vector<string>
132 return collectStr<vector<string>> (elms...);
144 using Val =
typename lib::meta::ValueTypeBinding<IT>::value_type;
152 template<
class CON,
typename TOGGLE =
void>
155 using StlIter =
typename CON::const_iterator;
160 : iter(begin(collection), end(collection))
170 : iter(std::forward<IT>(srcIter))
200 join (CON&& coll,
string const& delim =
", ")
202 using Coll =
typename lib::meta::Strip<CON>::TypePlain;
203 _RangeIter<Coll> range(std::forward<CON>(coll));
205 auto strings =
stringify (std::move (range.iter));
206 if (!strings)
return "";
208 std::ostringstream buffer;
209 for ( ; strings; ++strings)
210 buffer << *strings << delim;
213 size_t len = buffer.str().length();
214 ASSERT (len >= delim.length());
215 return buffer.str().substr(0, len - delim.length());
220 join (std::initializer_list<X>
const&& ili,
string const& delim =
", ")
222 return join (ili, delim);
228 template<
typename...ARGS>
236 template<
typename...ARGS>
244 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...