This reduces compile times (by compiling the function only once) and
eliminates the header dependency on `common/StackStringStream.h`.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
#include "DecayCounter.h"
#include "Formatter.h"
+#include "StackStringStream.h"
#include "include/encoding.h"
val = newval;
last_decay = now;
}
+
+std::ostream& operator<<(std::ostream& out, const DecayCounter& d) {
+ CachedStackStringStream css;
+ css->precision(2);
+ double val = d.get();
+ *css << "[C " << std::scientific << val << "]";
+ return out << css->strv();
+}
#define CEPH_DECAYCOUNTER_H
#include "include/buffer.h"
-#include "common/StackStringStream.h"
#include "common/ceph_time.h"
#include <cmath>
#include <list>
-#include <sstream>
namespace ceph { class Formatter; }
c.decode(p);
}
-inline std::ostream& operator<<(std::ostream& out, const DecayCounter& d) {
- CachedStackStringStream css;
- css->precision(2);
- double val = d.get();
- *css << "[C " << std::scientific << val << "]";
- return out << css->strv();
-}
+std::ostream& operator<<(std::ostream& out, const DecayCounter& d);
#endif