format/sepnewline.cpp

The following code example is taken from the book
C++23 - The Complete Guide by Nicolai M. Josuttis, Leanpub, 2026
The code is licensed under a Creative Commons Attribution 4.0 International License. Creative Commons License

// raw code

#include <print>
#include <vector>
#include <set>
#include "sepnewline.hpp"

int main()
{
  std::vector<int> data{0, 8, 15, 11};
  std::println("{}", data);
  std::println("{}", SepNewlineView(data));
  std::println("{}", data | sepNewline);
  std::println("{}", std::set{"tic", "tac", "toe"} | sepNewline);
}