diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-10-29 00:32:44 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-11-05 20:04:38 +0000 |
commit | c22216439c91619dbf7ebbf5f9f65816d040715f (patch) | |
tree | 7ff100760a4d8dec3aaa9b709f9f7d5b31be8015 /lib/stream_support.h | |
parent | Support regenerating the terrain mesh from updated geodata (diff) | |
download | ilt-c22216439c91619dbf7ebbf5f9f65816d040715f.tar.bz2 ilt-c22216439c91619dbf7ebbf5f9f65816d040715f.tar.xz ilt-c22216439c91619dbf7ebbf5f9f65816d040715f.zip |
Update operator<< for collections to work with ranges
Diffstat (limited to 'lib/stream_support.h')
-rw-r--r-- | lib/stream_support.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/stream_support.h b/lib/stream_support.h index d71356c..423c7d4 100644 --- a/lib/stream_support.h +++ b/lib/stream_support.h @@ -17,14 +17,14 @@ concept NonStringIterableCollection namespace std { std::ostream & - operator<<(std::ostream & s, const NonStringIterableCollection auto & v) + operator<<(std::ostream & s, const NonStringIterableCollection auto & collection) { s << '('; - for (const auto & i : v) { - if (&i != &*v.begin()) { + for (size_t nth {}; const auto & element : collection) { + if (nth++) { s << ", "; } - s << i; + s << element; } return s << ')'; } |