35 std::ifstream file(path, std::ios::binary);
38 *error =
"cannot open file: " + path;
43 std::vector<uint8_t> data { std::istreambuf_iterator<
char>(file), std::istreambuf_iterator<
char>() };
44 return load(data.data(), data.size(), error);
51 auto result = read_country_data(data, length,
52 [
this](
M49Code code, CountryPolygon&& polygon) {
53 m_countries.emplace(code, std::move(polygon));
56 if (result.failed()) {
58 *error = result.message() +
" at offset " + std::to_string(result.position());