L
lionheart
Hi,
I am currently trying to group my classes using namespaces. But since
these groups are not really independend I end up to have a lot of
forward declarations.
My first approache was to enclose all class definitions and forward
declarations in the corresponding headers directly. Which turned out to
make it difficult to read the header, and created a lot of overhead.
Therefore at the moment I am using a headerfile dedicated to forward
delcarations which are enclosed in the correct namespace. Is this a
common strategie? What are the up- and downsides from your perspective?
What are the alternatives?
In the headerfiles I am not using the "using-directive" to import
classnames in the namespace, because I don't want to make them
accessible through a second namespace. Same reason we I don't create a
"shortcut-namespace" (e.g. namespace abc = ada::basic::cobol). But
since I am using the namespace hierachie directly, first there is a lot
of overhead in writting and second if I change the namespaces I have to
change it in every single file. Is there an alterative? If the
using-directive would make the namespace/class imported visible from
outside it would be my perfect choice.
In the .cpp files I take advantage of the the using-directive a lot.
Since all .cpp-files are closed entities it should be fine to do so,
right?
Thanks for your help,
Thomas Kowalski
I am currently trying to group my classes using namespaces. But since
these groups are not really independend I end up to have a lot of
forward declarations.
My first approache was to enclose all class definitions and forward
declarations in the corresponding headers directly. Which turned out to
make it difficult to read the header, and created a lot of overhead.
Therefore at the moment I am using a headerfile dedicated to forward
delcarations which are enclosed in the correct namespace. Is this a
common strategie? What are the up- and downsides from your perspective?
What are the alternatives?
In the headerfiles I am not using the "using-directive" to import
classnames in the namespace, because I don't want to make them
accessible through a second namespace. Same reason we I don't create a
"shortcut-namespace" (e.g. namespace abc = ada::basic::cobol). But
since I am using the namespace hierachie directly, first there is a lot
of overhead in writting and second if I change the namespaces I have to
change it in every single file. Is there an alterative? If the
using-directive would make the namespace/class imported visible from
outside it would be my perfect choice.
In the .cpp files I take advantage of the the using-directive a lot.
Since all .cpp-files are closed entities it should be fine to do so,
right?
Thanks for your help,
Thomas Kowalski