"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
Dear Erik, May I suggest you try comp.lang.c++ forum, below is the URL: http://groups.google.com/groups?hl=en&lr=&ie=UTF -8&group=comp.lang.c%2B%2B This forum is more boost specific and I think you may have a better response posting into comp.lang.c++ Best regards, Mauricio Gomes On Aug 5, 2004, at 10:27 AM, Erik Thiele wrote:
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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Mauricio Gomes Pensar Digital phone: 55-11-3803-9707 mobile: 55-11-8319-9610 http://pensardigital.com
participants (2)
-
Erik Thiele
-
Mauricio Gomes