#1419 new planned

improve implementation of multiple-object formatting

Reported by: Ichthyostega Owned by:
Priority: nice Milestone:
Component: lumiera Keywords: refactor lib evolution
Sub Tickets: Parent Tickets:

Description

As a Lumiera developer,
I'd like to have an elegant formatting implementation,
that avoids to create a temporary vector on the heap to collect the results.

description

In lib/format-util.hpp, we have functionality to render an iterable into a sequence of strings (and then to join() them into a single string). This relies on our generic util::toString(). Furthermore, there are several variations of this API, among others, a variant that takes several objects as variadic arguments.

The latter feature has a small number of usages, some of which want to append the formatted objects to an already created container. Notably one use case, in EventLog, even uses a container with std::regexp — so, by calling emplace_back(), a regular expression will be created from each of the formatted strings.

So, to summarise, the design of this library function seems unsatisfactory; we have much better processing capabilities for variadic arguments at our disposal today, yet util::toString involves runtime processing and likely can never become constexpr. Furthermore, we might want to pass a std::range that can be used to populate a target container — since yesterday we even have the ability to iterate over a tuple at run-time 😃 (so #968 might be relevant)

Change history (0)

Note: See TracTickets for help on using tickets.