bidirectional iterator over file/ifstream

后端 未结 2 1860
醉梦人生
醉梦人生 2020-12-10 14:17

I need an input file stream which would have a bidirectional iterator/adapter.

Unfortunately std::ifstream (and similar) can be used only with std

2条回答
  •  囚心锁ツ
    2020-12-10 14:27

    Since you're already using boost, take a look at boost::iostreams::mapped_file_source http://www.boost.org/doc/libs/release/libs/iostreams/doc/classes/mapped_file.html#mapped_file_source

    You can use file.data() as the begin iterator and file.data() + file.size() as the end iterator.

提交回复
热议问题