diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-10-29 00:32:44 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-10-29 00:32:44 +0000 |
commit | b6880795627bc2f40a558c54af362df5dfc12b78 (patch) | |
tree | 7ff100760a4d8dec3aaa9b709f9f7d5b31be8015 | |
parent | Support regenerating the terrain mesh from updated geodata (diff) | |
download | ilt-b6880795627bc2f40a558c54af362df5dfc12b78.tar.bz2 ilt-b6880795627bc2f40a558c54af362df5dfc12b78.tar.xz ilt-b6880795627bc2f40a558c54af362df5dfc12b78.zip |
Update operator<< for collections to work with ranges
-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 << ')'; } |