Hi all,
in my C++ projects, I usually make "heavy use" of namespaces to
"encapsulate" my code. When I have for instance something like this:
namespace project
{
namespace part1 { ... }
namespace part2 { ... }
}
And I want to use this somewhere else, there seem to be four possibilities:
1) using namespace project; using namespace part1; using namespace part2;
2) using project::part1::Class1; using project::part2::Class2;
3) namespace p1=project::part1;
4) prepend everything with project::part2::
When I'm writing a cpp-file, I usually find myself using 1) -- I think
this is not really good, but as I'm affecting only my own code therein,
it shouldn't be too bad.
But what to do for a header-file which might be included by someone
else? 1) and 2) bring things into his namespace he does not want, and
even 3) introduces a namespace-shortcut he does not need.
So only 4) seems to leave everything without impact, except that I do
not really want to type project::part2:: every time and at least to my
taste this makes the code more unreadable.
What are best practices for this problem, if there are any? Or what
would you suggest to do?
Cheers,
Daniel Kraft
--
Got two Dear-Daniel-Instant Messages
by MSN, associate ICQ with stress --
so please use good, old E-MAIL!