A
ALiX
When not using any templates I use Stroustrup's convention for
oraganizing my headers. For example, if I am implementing a module
called mymodule, then I have the following header organization:
mymodule.hpp - contains declarations and inline functions needed by
users of my_module
mymodule-impl.hpp - contains all declarations needed by the module.
This file #includes mymodule.hpp for consistency checking.
mymodule.cpp - contains the definitions. #includes mymodule-impl.hpp
I'd like to know what conventions others use when a module contains
templated functions and/or classes. My own attempts at a general
convention has failed. For example I once tried:
mymodule.hpp - declarations and inline functions for users. Must
#include mymodule-templ.hpp.
mymodule-templ.hpp - definitions of templated functions/members
needed by users
mymodule-impl.hpp - contains all declarations. #includes
mymodule.hpp for consistency.
mymodule.cpp - contains all non-template definitions. #includes
mymodule-impl.hpp
The problem is that sometimes functions in mymodule-templ.hpp need to
use functions not intended for users. Thereofore, I end up #including
mymodule-impl.hpp within mymodule-templ.hpp anyway, and so making
every declaration visible to the users code.
Cheers,
/ALiX
oraganizing my headers. For example, if I am implementing a module
called mymodule, then I have the following header organization:
mymodule.hpp - contains declarations and inline functions needed by
users of my_module
mymodule-impl.hpp - contains all declarations needed by the module.
This file #includes mymodule.hpp for consistency checking.
mymodule.cpp - contains the definitions. #includes mymodule-impl.hpp
I'd like to know what conventions others use when a module contains
templated functions and/or classes. My own attempts at a general
convention has failed. For example I once tried:
mymodule.hpp - declarations and inline functions for users. Must
#include mymodule-templ.hpp.
mymodule-templ.hpp - definitions of templated functions/members
needed by users
mymodule-impl.hpp - contains all declarations. #includes
mymodule.hpp for consistency.
mymodule.cpp - contains all non-template definitions. #includes
mymodule-impl.hpp
The problem is that sometimes functions in mymodule-templ.hpp need to
use functions not intended for users. Thereofore, I end up #including
mymodule-impl.hpp within mymodule-templ.hpp anyway, and so making
every declaration visible to the users code.
Cheers,
/ALiX