Created
December 24, 2015 19:37
-
-
Save pmiddend/abc1b29f8f95de308295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file_table const | |
read_file_table( | |
boost::filesystem::path const &p) | |
{ | |
typedef | |
std::vector<fcppt::optional<file_table_entry>> | |
optional_file_table; | |
boost::filesystem::ifstream file_stream{p}; | |
optional_file_table::size_type const max_cmp_fat_entries{200}; | |
optional_file_table result; | |
result.reserve(max_cmp_fat_entries); | |
std::generate_n( | |
result.begin(), | |
max_cmp_fat_entries, | |
[&file_stream]() { auto entry = read_single_file_table_entry(file_stream); std::cerr << entry.get_unsafe().name() << "\n"; return entry; }); | |
return | |
fcppt::algorithm::map_concat<file_table>( | |
result, | |
[](optional_file_table::value_type const &r) | |
{ | |
return | |
fcppt::maybe( | |
r, | |
[]() { return file_table{}; }, | |
[](file_table_entry const &e) { return file_table{e}; }); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment