Skip to content

Commit b8489fd

Browse files
committed
perf: remove ostringstream
1 parent 588fd73 commit b8489fd

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

tdigest/include/tdigest_impl.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#include <algorithm>
2424
#include <cmath>
25-
#include <sstream>
2625

2726
#include "common_defs.hpp"
2827
#include "memory_operations.hpp"
@@ -32,18 +31,14 @@ namespace datasketches {
3231
template<typename T>
3332
inline void check_not_nan(T value, const char* name) {
3433
if (std::isnan(value)) {
35-
std::ostringstream oss;
36-
oss << name << " must not be NaN";
37-
throw std::invalid_argument(oss.str());
34+
throw std::invalid_argument(std::string(name) + " must not be NaN");
3835
}
3936
}
4037

4138
template<typename T>
4239
inline void check_not_infinite(T value, const char* name) {
4340
if (std::isinf(value)) {
44-
std::ostringstream oss;
45-
oss << name << " must not be infinite";
46-
throw std::invalid_argument(oss.str());
41+
throw std::invalid_argument(std::string(name) + " must not be infinite");
4742
}
4843
}
4944

0 commit comments

Comments
 (0)