The title pretty much says it all.
I am implementing my own streambuf class, and I am wondering what the Committee was thinking when they decided to include both std::streambuf::seekpos()
and std::streambuf::seekoff()
(and similarly for the related pubseekpos()
and pubseekoff()
).
It seems to me that seekpos(x)
should have the same effect as seekoff(x, std::ios::beg)
in every circumstance I can imagine. But perhaps my imagination is not good enough. So, why would you want to have both when seekpos
is completely subsumed by seekoff
? Or at least, why would you not make the default implementation of the former simply invoke the latter?
If the answer is "because that is what the STL did" or similar, then assume I am asking about the rationale for the STL or similar.
(I realize that the first argument of seekpos
is a streampos
while the first argument of seekoff
is a streamoff
. But note that 27.4.3.2 [lib.fpos.operations] requires that stream positions be convertible to stream offsets and back, so I do not think this is the answer.)