diff --git a/src/mongo/db/query/compiler/rewrites/boolean_simplification/bitset_algebra.cpp b/src/mongo/db/query/compiler/rewrites/boolean_simplification/bitset_algebra.cpp index 1e6d72b9d7c..dfff21b8c00 100644 --- a/src/mongo/db/query/compiler/rewrites/boolean_simplification/bitset_algebra.cpp +++ b/src/mongo/db/query/compiler/rewrites/boolean_simplification/bitset_algebra.cpp @@ -31,7 +31,6 @@ // IWYU pragma: no_include "ext/alloc_traits.h" #include "mongo/util/assert_util.h" -#include "mongo/util/stream_utils.h" #include #include @@ -233,7 +232,11 @@ bool operator==(const Maxterm& lhs, const Maxterm& rhs) { } std::ostream& operator<<(std::ostream& os, const Maxterm& maxterm) { - using mongo::operator<<; - return os << maxterm.minterms; + os << "["; + StringData sep; + for (auto&& t : maxterm.minterms) + os << std::exchange(sep, ", ") << t; + os << "]"; + return os; } } // namespace mongo::boolean_simplification diff --git a/src/mongo/db/query/compiler/rewrites/boolean_simplification/bitset_tree.cpp b/src/mongo/db/query/compiler/rewrites/boolean_simplification/bitset_tree.cpp index 3db3ecb4fc6..87a9cfcabae 100644 --- a/src/mongo/db/query/compiler/rewrites/boolean_simplification/bitset_tree.cpp +++ b/src/mongo/db/query/compiler/rewrites/boolean_simplification/bitset_tree.cpp @@ -30,7 +30,6 @@ #include "mongo/db/query/compiler/rewrites/boolean_simplification/bitset_tree.h" #include "mongo/util/assert_util.h" -#include "mongo/util/stream_utils.h" namespace mongo::boolean_simplification { namespace { @@ -207,9 +206,12 @@ BitsetTreeNode convertToBitsetTree(const Maxterm& maxterm) { } std::ostream& operator<<(std::ostream& os, const BitsetTreeNode& tree) { - using mongo::operator<<; - os << tree.type << ":" << tree.isNegated << "--" << tree.leafChildren << " " - << tree.internalChildren; + os << tree.type << ":" << tree.isNegated << "--" << tree.leafChildren << " "; + os << "["; + StringData sep; + for (auto&& node : tree.internalChildren) + os << std::exchange(sep, ", ") << node; + os << "]"; return os; } } // namespace mongo::boolean_simplification diff --git a/src/mongo/util/stream_utils.h b/src/mongo/util/stream_utils.h deleted file mode 100644 index 511b96ae1fe..00000000000 --- a/src/mongo/util/stream_utils.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (C) 2023-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include -#include - -#include - -namespace mongo { -/** - * Generic implementaion of output operator<< for std::vector<>. It requires that the vector's - * value_type has operator<< defined. - */ -template -std::ostream& operator<<(std::ostream& os, const std::vector& v) { - os << '['; - for (std::size_t i = 0; i < v.size(); ++i) { - if (i != 0) { - os << ", "; - } - os << v[i]; - } - os << ']'; - return os; -} - -/** - * Generic implementation of operator<< for std::optional<>. It requires that the optional's - * value_type has operator<< defined. - */ -template -std::ostream& operator<<(std::ostream& os, const boost::optional& val) { - if (val) { - os << *val; - } else { - os << ""; - } - return os; -} - -} // namespace mongo