Boost logo

Boost Users :

From: Jeff Williams (jwilliams_at_[hidden])
Date: 2004-08-05 09:29:49


I think typically the solution is to just prefix std:: to everything. Once you get used to doing it, it doesn't even seem cumbersome anymore. (well that's my opinion at least)

>
> From: Erik Thiele <erik_at_[hidden]>
> Date: 2004/08/05 Thu AM 09:27:10 EDT
> To: boost-users_at_[hidden]
> Subject: [Boost-users] "using namespace" in template implementation files
>
> hi
>
> i don't find any docs about that issue, so i ask it here:
>
> the usual approach to work with templates and separated
> interface and implementation is as follows (i hope):
>
> x.hpp:
>
> template<class a> void foo(std::string xxx);
> #include "x_impl.hpp"
>
>
> x_impl.hpp:
>
> template<class a> void foo(std::string xxx)
> {
> string bla = xxx + "sdjkfh"; // <-- no std:: here !!!!
> cout << bla;
> }
>
>
>
> usually in normal non-template coding style i can do
>
> using namespace std;
>
> on the top of each .cpp file. but now i cannot do it, because it is
> actually in a header file and i don't want to include another namespace
> in the interface definition.
>
> how can i solve the problem? i don't want to write "using namespace std"
> at the beginning of every template function declaration, but only once
> per implementation file.
>
>
> cu & thx
> erik
>
>
> --
> Erik Thiele
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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