$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Phillip Seaver (phil_at_[hidden])
Date: 2007-06-01 11:00:47
I ran into a problem when using restrict on a file_source. The problem 
was that it decided that the stream wasn't seekable and called the 
version of skip that reads a character at a time until it gets to the 
requested offset, instead of just calling seek.
The code was similar to this:
namespace io = boost::iostreams;
std::string filename;
io::filtering_istream rstr(io::restrict(io::file_source(filename),
     10, 100));
I've attached a patch that solved my problem. It was checking to see if
the device was seekable (which means input_seekable and
output_seekable), but since it was an input device, it was just
input_seekable.
Phillip Seaver
--- skip.hpp.orig	2007-03-20 16:20:55.253000000 -0400
+++ skip.hpp	2007-03-20 16:11:51.096750000 -0400
@@ -67,7 +67,17 @@
 void skip(Device& dev, stream_offset off)
 { 
     typedef typename mode_of<Device>::type mode;
-    detail::skip(dev, off, is_convertible<mode, seekable>());
+    typedef mpl::or_<
+        mpl::and_<
+            is_convertible<mode, input>,
+            is_convertible<mode, input_seekable>
+        >,
+        mpl::and_<
+            is_convertible<mode, output>,
+            is_convertible<mode, output_seekable>
+        >
+    > can_seek;
+    detail::skip(dev, off, can_seek());
 }
 
 template<typename Filter, typename Device>