Boost C++ Libraries: Ticket #1727: Sample code in documentation does not compile, has namespace errors. https://svn.boost.org/trac10/ticket/1727 <p> The example code at the very end of this <a href="http://www.boost.org/libs/iostreams/doc/classes/bzip2.html">http://www.boost.org/libs/iostreams/doc/classes/bzip2.html</a> page which decompresses data from a file and writes it to standard out is erroneous and does not compile. The boost::iostream namespace is not specified. The code should be as follows, I have verified that it compiles and runs properly: </p> <pre class="wiki">int main(int argc, char** argv) { using namespace std; using namespace boost::iostreams; ifstream file("hello.bz2", ios_base::in | ios_base::binary); filtering_streambuf&lt;input&gt; in; in.push(bzip2_decompressor()); in.push(file); copy(in, cout); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1727 Trac 1.4.3 Mukkarum.Amin@… Sat, 29 Mar 2008 03:35:58 GMT <link>https://svn.boost.org/trac10/ticket/1727#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1727#comment:1</guid> <description> <p> Replying to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1727" title="#1727: Bugs: Sample code in documentation does not compile, has namespace errors. (closed: fixed)">Mukkarum.Amin@gmail.com</a>: </p> <blockquote class="citation"> <p> The example code at the very end of this <a href="http://www.boost.org/libs/iostreams/doc/classes/bzip2.html">http://www.boost.org/libs/iostreams/doc/classes/bzip2.html</a> page which decompresses data from a file and writes it to standard out is erroneous and does not compile. The boost::iostream namespace is not specified. The code should be as follows, I have verified that it compiles and runs properly: </p> <pre class="wiki">int main(int argc, char** argv) { using namespace std; using namespace boost::iostreams; ifstream file("hello.bz2", ios_base::in | ios_base::binary); filtering_streambuf&lt;input&gt; in; in.push(bzip2_decompressor()); in.push(file); copy(in, cout); return 0; } </pre></blockquote> <p> <br /> </p> <p> Forgot to add includes here is the complete code with includes: </p> <pre class="wiki">#include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;boost/iostreams/filtering_streambuf.hpp&gt; #include &lt;boost/iostreams/copy.hpp&gt; #include &lt;boost/iostreams/filter/bzip2.hpp&gt; int main(int argc, char** argv) { using namespace std; using namespace boost::iostreams; ifstream file("hello.bz2", ios_base::in | ios_base::binary); filtering_streambuf&lt;input&gt; in; in.push(bzip2_decompressor()); in.push(file); copy(in, cout); return 0; } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Thu, 10 Apr 2008 21:11:27 GMT</pubDate> <title>owner, component changed https://svn.boost.org/trac10/ticket/1727#comment:2 https://svn.boost.org/trac10/ticket/1727#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Matias Capeletto</span> to <span class="trac-author">Jonathan Turkanis</span> </li> <li><strong>component</strong> <span class="trac-field-old">Documentation</span> → <span class="trac-field-new">iostreams</span> </li> </ul> Ticket Jonathan Turkanis Sun, 25 May 2008 23:49:02 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1727#comment:3 https://svn.boost.org/trac10/ticket/1727#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/45755" title="fixed #1727">[45755]</a>) fixed <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1727" title="#1727: Bugs: Sample code in documentation does not compile, has namespace errors. (closed: fixed)">#1727</a> </p> Ticket Jonathan Turkanis Sun, 25 May 2008 23:51:35 GMT <link>https://svn.boost.org/trac10/ticket/1727#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1727#comment:4</guid> <description> <p> Fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/45755" title="fixed #1727">[45755]</a>. I left in the namespace qualification in the call to copy, because it is good practice to prevent argument-dependent lookup from find another overload of copy (e.g., std::copy from &lt;algorithm&gt;) </p> </description> <category>Ticket</category> </item> </channel> </rss>