Closed mariusalexander closed 1 month ago
I like the idea to use a range object here.
I vote against having an implicit range conversion like in
gtDebug() << "My Fancy Range:" << {c.begin(), c.end()};
as the semantics of the initializer list is not clear. It could be any object initialized with to iterators.
Sometimes I long for a simple way of iterating over a range of iterators.
Use cases
operator<<
(i.e. where the value type is supported bygt::log::Stream
but the container class is not).gt::log::Stream::doLogIter
function that does the heavy lifting, but we have "hardcoded" the separators, prefix and suffix strings for each container type we support. (e.g.std::set
is logged like this: "{1, 2, 3, 4}")Possible Implementation
We could implement a standalone function that could be used like this:
Or simply using a initlializer list/pair