Boost logo

Boost Users :

From: Shunsuke Sogame (mb2act_at_[hidden])
Date: 2006-07-03 13:56:10


Johan Råde wrote:
> It seems that the header boost/spirit.hpp puts
> the entire namespace std into the global scope.
> That is not very nice!
>
> --- Example 1 --------
>
> #include <string>
> #include <sstream>
> #include <fstream>
> #include <vector>
> #include <boost/spirit.hpp>
>
> void f()
> {
> string s;
> istringstream iss;
> ofstream ofs;
> vector<int> v;
> }
>
> ----------------------
>
> Example 1 should not compile (undefined symbols), but does compile.
> If the line #include <boost/spirit.hpp> is removed,
> then Example 1 does not compile.
>
> --- Example 2 --------
>
> #include <boost/filesystem/path.hpp>
> #include <boost/filesystem/fstream.hpp>
>
> #include <boost/spirit.hpp>
>
> using boost::filesystem::path;
> using boost::filesystem::ifstream;
>
> void g()
> {
> path p;
> ifstream ifs(p);
> }
>
>
> ----------------------
>
> Example 2 should compile but does not.
> The compiler complains that the symbol ifstream is ambigous.
> If the line #include <boost/spirit.hpp> is removed,
> then Example 2 does compile.
>
> I´m using Boost 1.33.1 and MSVC 7.1 on a Windows XP computer.

IIRC, that comes from VC++ fatal bug about "using directive",
and was already fixed under RC_1_34.

-- 
Shunsuke Sogame

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net