On Thu, 24 Sep 2009 12:47:12 -0400, grauzone <n...@example.net> wrote:
Steven Schveighoffer wrote:
The solution we ended up using is that *all* streams defined the seek
function, even if they didn't support seeking, and if you called it on
such objects, they just throw an exception.
So, if you want to see if an object supports seeking, you must call the
method + catch the exception? How is this better than a dynamic cast?
It makes the requirement for things that want to wrap streams less
stringent. For example, I can implement a Buffer that handles both
seekable and non-seekable streams instead of 2 buffer types.
It also has less of a penalty for cases where you know the stream is
seekable.
-Steve