Skip to content
Snippets Groups Projects
Commit c4e41fd2 authored by Martin Beseda's avatar Martin Beseda
Browse files

FIX: Started using smart pointers in CSVReader, solving some memory leaks.

parent 239345d2
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@
#include <filesystem>
#include <regex>
#include <algorithm>
#include <memory>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/erase.hpp>
......@@ -25,7 +26,7 @@ namespace lib4neuro {
this->delimiter = delimiter;
this->ignore_first_line = ignore_first_line;
this->header_included = ignore_first_line;
this->data = new std::vector<std::vector<std::string>>;
this->data = std::make_unique<std::vector<std::vector<std::string>>>();
}
void CSVReader::read() {
......@@ -61,8 +62,8 @@ namespace lib4neuro {
ifs.close();
}
std::vector<std::vector<std::string>>* CSVReader::get_data() {
return this->data;
std::unique_ptr<std::vector<std::vector<std::string>>>* CSVReader::get_data() {
return &this->data;
}
void CSVReader::print_data() {
......
......@@ -43,7 +43,7 @@ namespace lib4neuro {
/**
*
*/
std::vector<std::vector<std::string>>* data;
std::unique_ptr<std::vector<std::vector<std::string>>> data;
public:
......@@ -64,7 +64,7 @@ namespace lib4neuro {
*
* @return
*/
LIB4NEURO_API std::vector<std::vector<std::string>>* get_data();
LIB4NEURO_API std::unique_ptr<std::vector<std::vector<std::string>>>* get_data();
/**
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment