29#ifndef LIB_FORMAT_UTIL_H
30#define LIB_FORMAT_UTIL_H
63 template<
class CON,
typename X,
typename...ELMS>
72 template<
class CON,
typename...ELMS>
77 operator+= (
string&& s)
79 CON::push_back (move(s));
86 template<
typename X,
typename...ELMS>
92 this->reserve(
sizeof...(ELMS));
96 operator+= (
string&& s)
98 this->emplace_back (move(s));
110 template<
class CON,
typename...ELMS>
114 SeqContainer<CON,ELMS...> storage;
115 do_stringify (storage, elms...);
116 return CON {move(storage)};
120 template<
typename...ELMS>
121 inline vector<string>
124 return collectStr<vector<string>> (elms...);
144 template<
class CON,
typename TOGGLE =
void>
152 :
iter(begin(collection), end(collection))
162 :
iter(
std::forward<IT>(srcIter))
194 join (COLL&& coll,
string const& delim =
", ")
197 _RangeIter<Coll> range(std::forward<COLL>(coll));
199 auto strings =
stringify (std::move (range.iter));
200 if (!strings)
return "";
202 std::ostringstream buffer;
203 for ( ; strings; ++strings)
204 buffer << *strings << delim;
207 size_t len = buffer.str().length();
208 ASSERT (len >= delim.length());
209 return buffer.str().substr(0, len - delim.length());
214 join (std::initializer_list<X>
const&& ili,
string const& delim =
", ")
216 return join (ili, delim);
222 template<
typename...ARGS>
230 template<
typename...ARGS>
238 template<
typename...ARGS>
252 return "("+
join (forward<COLL> (coll))+
")";
259 return "["+
join (forward<COLL> (coll))+
"]";
264 template<
typename T, std::
size_t N>
268 invoke (std::array<T,N>
const& arr)
noexcept
Accessing a STL element range through a Lumiera forward iterator, An instance of this iterator adapte...
Implementation namespace for support and library code.
auto transformIterator(IT const &src, FUN processingFunc)
Build a TransformIter: convenience free function shortcut, picking up the involved types automaticall...
vector< string > stringify(ELMS const &...elms)
standard setup: convert to string into a vector
string toStringBracket(COLL &&coll)
string joinDot(ARGS const &...args)
shortcut: join directly with dots
CON collectStr(ELMS const &...elms)
convert a sequence of elements to string
std::string toString(TY const &val) noexcept
get some string representation of any object, reliably.
string join(COLL &&coll, string const &delim=", ")
enumerate a collection's contents, separated by delimiter.
string joinArgList(ARGS const &...args)
shortcut: List in parentheses, separated by comma, using temporary vector
string toStringParen(COLL &&coll)
one-argument variant that can be forward declared...
string joinDash(ARGS const &...args)
shortcut: join directly with dashes
static std::string invoke(std::array< T, N > const &arr) noexcept
failsafe invocation of custom string conversion.
Marker types to indicate a literal string and a Symbol.
Helpers for type detection, type rewriting and metaprogramming.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...