3 ms·
My favorite way of handling this particular case (in any language) is to express the elements as a sequence (preferably a lazy one that doesn’t actually allocat
by wrs 2y ago
My favorite way of handling this particular case (in any language) is to express the elements as a sequence (preferably a lazy one that doesn’t actually allocate) and use whatever the stdlib calls “join” (my favorite name is Haskell’s “intercalate”) to insert the delimiters. I haven’t used C++ in decades, but Rust typically makes this pretty easy to write, and low-cost.