diff --git a/src/engine/idTable/IdTable.h b/src/engine/idTable/IdTable.h index f67bf25d42..291407935c 100644 --- a/src/engine/idTable/IdTable.h +++ b/src/engine/idTable/IdTable.h @@ -751,6 +751,15 @@ class IdTableStatic *(static_cast(this)) = std::move(b); return *this; } + + friend std::ostream& operator<<(std::ostream& os, + const IdTableStatic& idTable) { + os << "{ "; + std::ranges::copy( + idTable, std::ostream_iterator>(os, " ")); + os << "}"; + return os; + } }; // This was previously implemented as an alias (`using IdTable = @@ -766,15 +775,6 @@ class IdTable : public IdTableStatic<0> { IdTable(Base&& b) : Base(std::move(b)) {} }; -// ____________________________________________________________________________ -std::ostream& operator<<(std::ostream& os, const IdTable& idTable) { - os << "{ "; - std::ranges::copy( - idTable, std::ostream_iterator>(os, " ")); - os << "}"; - return os; -} - /// A constant view into an IdTable that does not own its data template using IdTableView = diff --git a/src/engine/idTable/IdTableRow.h b/src/engine/idTable/IdTableRow.h index 7656d2d482..2550b7a1c0 100644 --- a/src/engine/idTable/IdTableRow.h +++ b/src/engine/idTable/IdTableRow.h @@ -94,17 +94,16 @@ class Row { std::ranges::copy(*this, result.begin()); return result; } -}; -// ____________________________________________________________________________ -std::ostream& operator<<(std::ostream& os, - const columnBasedIdTable::Row& idTableRow) { - os << "("; - for (size_t i = 0; i < idTableRow.numColumns(); ++i) { - os << idTableRow[i] << (i < idTableRow.numColumns() - 1 ? " " : ")"); + template , bool> = true> + friend std::ostream& operator<<(std::ostream& os, const Row& idTableRow) { + os << "("; + for (size_t i = 0; i < idTableRow.numColumns(); ++i) { + os << idTableRow[i] << (i < idTableRow.numColumns() - 1 ? " " : ")"); + } + return os; } - return os; -} +}; // The following two classes store a reference to a row in the underlying // column-based `Table`. This has to be its own class instead of `Row&` because