SERVER-120620 remove util/stream_utils.h (#48806)

GitOrigin-RevId: 27e7bbca1029b050f9a567d8ad1cfb992d4befa8
This commit is contained in:
Billy Donahue
2026-03-02 11:52:43 -05:00
committed by MongoDB Bot
parent 56d8ca9542
commit 806bd6a563
3 changed files with 12 additions and 76 deletions

View File

@@ -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 <algorithm>
#include <ostream>
@@ -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

View File

@@ -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

View File

@@ -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
* <http://www.mongodb.com/licensing/server-side-public-license>.
*
* 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 <sstream>
#include <vector>
#include <boost/optional.hpp>
namespace mongo {
/**
* Generic implementaion of output operator<< for std::vector<>. It requires that the vector's
* value_type has operator<< defined.
*/
template <typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& 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 <typename T>
std::ostream& operator<<(std::ostream& os, const boost::optional<T>& val) {
if (val) {
os << *val;
} else {
os << "<nullopt>";
}
return os;
}
} // namespace mongo