Fix warning on older gcc versions
This commit is contained in:
parent
0b5f90a365
commit
f069733650
@ -5,17 +5,18 @@ using std::istream;
|
|||||||
using std::ofstream;
|
using std::ofstream;
|
||||||
using std::ifstream;
|
using std::ifstream;
|
||||||
using std::ios;
|
using std::ios;
|
||||||
|
using boost::optional;
|
||||||
|
|
||||||
namespace bf = boost::filesystem;
|
namespace bf = boost::filesystem;
|
||||||
|
|
||||||
namespace cpputils {
|
namespace cpputils {
|
||||||
|
|
||||||
boost::optional<Data> Data::LoadFromFile(const bf::path &filepath) {
|
optional<Data> Data::LoadFromFile(const bf::path &filepath) {
|
||||||
ifstream file(filepath.c_str(), ios::binary);
|
ifstream file(filepath.c_str(), ios::binary);
|
||||||
if (!file.good()) {
|
if (!file.good()) {
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
auto result = LoadFromStream(file);
|
optional<Data> result(LoadFromStream(file));
|
||||||
if (!file.good()) {
|
if (!file.good()) {
|
||||||
throw std::runtime_error("Error reading from file");
|
throw std::runtime_error("Error reading from file");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user