use smart pointer v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 10 Dec 2018 15:19:33 +0100
branchv_0
changeset 7 25586cc569aa
parent 6 0afcab6ee191
child 8 08ee0c51664e
use smart pointer
src/PassthroughHandler.h
--- a/src/PassthroughHandler.h	Mon Dec 10 10:47:34 2018 +0100
+++ b/src/PassthroughHandler.h	Mon Dec 10 15:19:33 2018 +0100
@@ -44,14 +44,11 @@
 // TODO: use rather RelationalReaderValueHadler
 class PassthroughHandler : public RelationalReaderStringHadler {
 private:
-	writer::RelationalWriter* relationalWriter;
+	std::shared_ptr<writer::RelationalWriter> relationalWriter;
 public:
 
-	PassthroughHandler(std::ostream& output) : relationalWriter(writer::Factory::create(output)) {
-	}
-
-	virtual ~PassthroughHandler() {
-		delete relationalWriter;
+	PassthroughHandler(std::ostream& output) {
+		relationalWriter.reset(writer::Factory::create(output));
 	}
 
 	void startRelation(string_t name, std::vector<AttributeMetadata> attributes) override {