Re: [Boost-bugs] [Boost C++ Libraries] #1727: Sample code in documentation does not compile, has namespace errors.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1727: Sample code in documentation does not compile, has namespace errors.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-03-29 03:35:58


#1727: Sample code in documentation does not compile, has namespace errors.
--------------------------------------+-------------------------------------
  Reporter: Mukkarum.Amin_at_[hidden] | Owner: matias
      Type: Bugs | Status: new
 Milestone: | Component: Documentation
   Version: | Severity: Problem
Resolution: | Keywords: Documentation error
--------------------------------------+-------------------------------------
Comment (by Mukkarum.Amin_at_[hidden]):

 Replying to [ticket:1727 Mukkarum.Amin_at_[hidden]]:
> The example code at the very end of this
 [http://www.boost.org/libs/iostreams/doc/classes/bzip2.html] 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:
> {{{
> 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<input> in;
> in.push(bzip2_decompressor());
> in.push(file);
> copy(in, cout);
> return 0;
> }
> }}}
 [[BR]]


 Forgot to add includes here is the complete code with includes:
 {{{
 #include <fstream>
 #include <iostream>
 #include <boost/iostreams/filtering_streambuf.hpp>
 #include <boost/iostreams/copy.hpp>
 #include <boost/iostreams/filter/bzip2.hpp>

 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<input> in;
   in.push(bzip2_decompressor());
   in.push(file);
   copy(in, cout);
   return 0;
 }
 }}}

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1727#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC