-
Notifications
You must be signed in to change notification settings - Fork 40
Coding Standard
Jay Kickliter edited this page May 13, 2017
·
10 revisions
- Types and namespaces should be written in
UpperCammelCase
. - Functions and variables should be written in
lowerCammelCase
. - Class member variables should be suffixed with an underscore.
- Integral non type template parameters should be written in
lowerCammelCase
(justification: there is no real need to distinguish these from normal constant variables) - Type template parameters should be prefixed with
T
(justification: because of special syntax regarding dependent names this should ease spotting them) - Templated type aliases to meta function should be suffixed with
T
- Type aliases to meta functions which are designed to be used as predicates should be suffixed with
P
- If a number represents a bit mask it should be written in hexadecimal format eg.
0x03
rather than3
.
- All type templates should include a nested alias to themselves named '
Type
'. - Returning from a Meta function should be done by inheriting from the return type.
- Recursion and calling other meta functions should also be achieved by inheritance.
- For clarity meta functions should be broken up into small named pieces whenever possible.
- Implementation details should be placed in the namespace '
Detail
'. Anything not in aDetail
namespace should be safe to be instantiated by the user and have decent error messages when supplied implausible parameters. - All meta functions exposed to the user should have a constexpr equivalent for more natural calling
- All constexpr variables should be initialized for compatibility with compiler bugs
- The Library is not meant to only be used as a whole. Coupling and dependencies between modules should be kept to a minimum in order to allow users to only use parts.
- Dependence on the MPL is unavoidable for most modules, therefore the MPL must have zero overhead as far as resources and little compile time.