As the testing code (but not just) is full of the following sequence:
- dyn-allocating a Formatter;
- using it in its 'naked pointer' form;
- deleting it;
which is not a recommended practice.
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
#include <deque>
#include <list>
+#include <memory>
#include <vector>
#include <stdarg.h>
#include <sstream>
static Formatter *create(std::string_view type) {
return create(type, "json-pretty", "");
}
+ template <typename... Params>
+ static std::unique_ptr<Formatter> create_unique(Params &&...params)
+ {
+ return std::unique_ptr<Formatter>(
+ Formatter::create(std::forward<Params>(params)...));
+ }
Formatter();
virtual ~Formatter();