diff options
author | Brett Nawrocki <brett.nawrocki@mongodb.com> | 2022-08-30 15:07:00 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-01 16:33:40 +0000 |
commit | 54dfa66ba84af002a0b43d2b7f49e0a8119f6c55 (patch) | |
tree | e997374e3ee6236746ee20655b88d3bcd4899c20 /src/mongo/util | |
parent | 3b8505623b8eba4880d28fb69e5bf1385af58a2b (diff) | |
download | mongo-54dfa66ba84af002a0b43d2b7f49e0a8119f6c55.tar.gz |
SERVER-68783 Disambiguate 0 time estimate from no estimate in resharding
Diffstat (limited to 'src/mongo/util')
-rw-r--r-- | src/mongo/util/optional_util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/util/optional_util.h b/src/mongo/util/optional_util.h index dca4ab7b7c4..e1820af7320 100644 --- a/src/mongo/util/optional_util.h +++ b/src/mongo/util/optional_util.h @@ -139,4 +139,15 @@ template <typename T, std::enable_if_t<canStreamWithExtension<T>, int> = 0> Extension(const T& t)->Extension<T>; } // namespace optional_io + +namespace optional_util { +template <typename T, typename U> +void setOrAdd(boost::optional<T>& counter, U value) { + if (!counter) { + counter = value; + return; + } + counter = *counter + value; +} +} // namespace optional_util } // namespace mongo |