2
« on: July 25, 2012, 11:06:44 pm »
I recently found myself needing a seek method on sf::Packet in order to read some data from an arbitrary byte offset into the packet. I could have read the entire packet into an array and then parsed it myself using the network-to-host set of functions in C while keeping track of the index I'm at, etc. But that's reimplementing a lot of functionality already provided by the packet class. So I looked into the implementation and found that a Packet just uses a std::vector to store all the data and size_t to keep track of the index. A seek method can literally be implemented in two lines of code by just setting m_readPos and m_isValid.
Would a seek method expose too much of the implementation or does this seem like a reasonable feature to implement?