Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing boost::iostreams mapped_file_source and filtering_streambuf to decompress file
    primarykey
    data
    text
    <p>I plan to process large compressed files and I would like to memory map the files to speedup reading. I adopted the existing example with regular file input but cannot get it either compile nor work :-) I'm using C++ Boost 1.49</p> <p>Any suggestion welcome!</p> <pre><code>#include&lt;iostream&gt; #include&lt;boost/iostreams/filtering_streambuf.hpp&gt; #include&lt;boost/iostreams/copy.hpp&gt; #include&lt;boost/iostreams/filter/zlib.hpp&gt; #include&lt;boost/iostreams/device/file.hpp&gt; #include&lt;boost/iostreams/device/mapped_file.hpp&gt; void test_decoder_mmf() { using namespace std; using namespace boost::iostreams; //ifstream file("my_file.txt", ios_base::in | ios_base::binary); mapped_file_source file( "my_file.txt" ); filtering_streambuf&lt; input &gt; in; in.push(zlib_decompressor()); in.push(file); copy(in,cout); } int main() { test_decoder_mmf(); return 0; } In file included from /usr/local/include/boost/iostreams/operations.hpp:20:0, from /usr/local/include/boost/iostreams/detail/adapter/mode_adapter.hpp:24, from /usr/local/include/boost/iostreams/detail/resolve.hpp:19, from /usr/local/include/boost/iostreams/detail/push.hpp:24, from /usr/local/include/boost/iostreams/chain.hpp:29, from /usr/local/include/boost/iostreams/filtering_streambuf.hpp:17, from test_boost_iostreams2.cc:2: /usr/local/include/boost/iostreams/optimal_buffer_size.hpp: In function ‘std::streamsize boost::iostreams::optimal_buffer_size(const T&amp;) [with T = boost::iostreams::mapped_file_source, std::streamsize = long int]’: /usr/local/include/boost/iostreams/chain.hpp:248:9: instantiated from ‘void boost::iostreams::detail::chain_base&lt;Self, Ch, Tr, Alloc, Mode&gt;::push_impl(const T&amp;, std::streamsize, std::streamsize) [with T = boost::iostreams::mapped_file_source, Self = boost::iostreams::chain&lt;boost::iostreams::input, char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, Ch = char, Tr = std::char_traits&lt;char&gt;, Alloc = std::allocator&lt;char&gt;, Mode = boost::iostreams::input, std::streamsize = long int]’ /usr/local/include/boost/iostreams/chain.hpp:216:1: instantiated from ‘void boost::iostreams::detail::chain_base&lt;Self, Ch, Tr, Alloc, Mode&gt;::push(const T&amp;, std::streamsize, std::streamsize, typename boost::disable_if&lt;boost::iostreams::is_std_io&lt;T&gt; &gt;::type*) [with T = boost::iostreams::mapped_file_source, Self = boost::iostreams::chain&lt;boost::iostreams::input, char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, Ch = char, Tr = std::char_traits&lt;char&gt;, Alloc = std::allocator&lt;char&gt;, Mode = boost::iostreams::input, std::streamsize = long int, typename boost::disable_if&lt;boost::iostreams::is_std_io&lt;T&gt; &gt;::type = void]’ /usr/local/include/boost/iostreams/chain.hpp:500:7: instantiated from ‘void boost::iostreams::detail::chain_client&lt;Chain&gt;::push_impl(const T&amp;, std::streamsize, std::streamsize) [with T = boost::iostreams::mapped_file_source, Chain = boost::iostreams::chain&lt;boost::iostreams::input, char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::streamsize = long int]’ /usr/local/include/boost/iostreams/chain.hpp:488:1: instantiated from ‘void boost::iostreams::detail::chain_client&lt;Chain&gt;::push(const T&amp;, std::streamsize, std::streamsize, typename boost::disable_if&lt;boost::iostreams::is_std_io&lt;T&gt; &gt;::type*) [with T = boost::iostreams::mapped_file_source, Chain = boost::iostreams::chain&lt;boost::iostreams::input, char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::streamsize = long int, typename boost::disable_if&lt;boost::iostreams::is_std_io&lt;T&gt; &gt;::type = void]’ test_boost_iostreams2.cc:17:17: instantiated from here /usr/local/include/boost/iostreams/optimal_buffer_size.hpp:39:55: error: ‘optimal_buffer_size’ is not a member of ‘impl {aka boost::iostreams::detail::optimal_buffer_size_impl&lt;boost::iostreams::mapped_file_source&gt;}’ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload