diff --git a/src/cpp-utils/data/Data.cpp b/src/cpp-utils/data/Data.cpp index ce649269..137635bd 100644 --- a/src/cpp-utils/data/Data.cpp +++ b/src/cpp-utils/data/Data.cpp @@ -5,17 +5,18 @@ using std::istream; using std::ofstream; using std::ifstream; using std::ios; +using boost::optional; namespace bf = boost::filesystem; namespace cpputils { -boost::optional Data::LoadFromFile(const bf::path &filepath) { +optional Data::LoadFromFile(const bf::path &filepath) { ifstream file(filepath.c_str(), ios::binary); if (!file.good()) { return boost::none; } - auto result = LoadFromStream(file); + optional result(LoadFromStream(file)); if (!file.good()) { throw std::runtime_error("Error reading from file"); }