vimpunk / mio

Cross-platform C++11 header-only library for memory mapped file IO
MIT License
1.71k stars 157 forks source link

Map entire file by default. #28

Closed jdarpinian closed 6 years ago

vimpunk commented 6 years ago

@jdarpinian That's a great idea, thanks! This is something I wanted to do as well, but I hit a wall when trying to extend the idea to the map member functions, which take a std::error_code& as their last argument. In retrospect, I think it should have been the first argument, or even the return value--though this would have broken symmetry with APIs that return something else and thus need error code to be an out parameter. But I digress.

Can you please apply the same changes to basic_shared_mmap as well (preferably as an amended commit)?

vimpunk commented 6 years ago

Just realized that the mapping functions could be overloaded to just map(path|handle, error_code&) to provide the same default behavior of mapping the entire file. Would you be willing to implement these as well? It's ok if not, I can patch it after merging your PR.

jdarpinian commented 6 years ago

Done!

vimpunk commented 6 years ago

Great work, thank you so much!