vimpunk / mio

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

Troubles with replacing boost::iostreams::mapped_file_source due to non-copy attribute #70

Closed BullyWiiPlaza closed 3 years ago

BullyWiiPlaza commented 3 years ago

So, I was about to replace Boost in my project and since I'm using boost::iostreams::mapped_file_source I stumpled across mio. Sadly, the non-copyable nature of mio causes plenty of hard to find compilation errors regarding object copying. Is that restriction really necessary? Boost gets along without this restriction just fine.

Would you suggest using std::move() everywhere or maybe wrapping mio::mmap_source into a std::shared_ptr when migrating?

BullyWiiPlaza commented 3 years ago

Sorry, it looks like I didn't read the README carefully enough. 👍

You can do this via mio::shared_mmap_source.