vectorstream updates: added seekoff and seekpos (#2179)
* [DLIB] added seekpos and seekoff functions. These are necessary for functions in iostream base class to work properly. e.g. seekg. Note that in seekoff, you do NOT want to check the validity of read_pos after it has been updated. dlib::vectorstream and std::iostream work together to set EOF and/or badbit. Doing something like seekg(10000) should not throw even if the underlying buffer has 2 bytes. You should check if EOF is set and possibly call clear(). We have removed seekg from dlib::vectorstream as this adds confusion. Now std::iostream::seekg is called which somewhere down the callstack will call seekpos and/or seekoff. So there should be no diverging functionality between calling seekg on dlib::vectorstream& or std::iostream& when there is a cast.
* [DLIB] vectorstream unit test is updated to run identical tests on dlib::vectorstream& and std::iostream&
* [DLIB] only support read pointers and delete copy and move semantics
* [DLIB] explicit tests for seekg() in different directions
* [DLIB] - no need to delete the move constructor and move assign operator. This is implicitly done by deleting the copy constructor and copy assign operator.
* [DLIB] - remove leftover comments. no need
- use more idiomatic notation
Co-authored-by:
pf <pf@pf-ubuntu-dev>
Showing
Please register or sign in to comment