From f069733650db98ee3f4327611f948cad354f88e4 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Fri, 22 Jul 2016 02:57:03 +0200 Subject: [PATCH] Fix warning on older gcc versions --- src/cpp-utils/data/Data.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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"); }