summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-10-29 00:32:44 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-11-05 20:04:38 +0000
commitc22216439c91619dbf7ebbf5f9f65816d040715f (patch)
tree7ff100760a4d8dec3aaa9b709f9f7d5b31be8015
parentSupport regenerating the terrain mesh from updated geodata (diff)
downloadilt-c22216439c91619dbf7ebbf5f9f65816d040715f.tar.bz2
ilt-c22216439c91619dbf7ebbf5f9f65816d040715f.tar.xz
ilt-c22216439c91619dbf7ebbf5f9f65816d040715f.zip
Update operator<< for collections to work with ranges
-rw-r--r--lib/stream_support.h8
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 << ')';
}