Problem Statement
There is no documented standard for which file extension to use when separating template implementation from declarations (.inl, .tpp, or .ipp), nor when such files should be introduced at all. This leads to inconsistency across the codebase and confusion for contributors writing templated code.
Proposed Solution
- Evaluate the three common conventions (.inl, .tpp, .ipp) and decide on one as the project standard, based on community adoption and tooling support.
- Document:
- Which extension is chosen and why.
- When a separate implementation file is appropriate (e.g. non-trivial template implementations, keeping headers readable).
- How to include the file at the bottom of the corresponding header:
// MyClass.hpp
#include "MyClass.inl" // or .tpp / .ipp
- Apply the chosen convention consistently across existing files.
Alternative Solutions
- Keep template implementations inline in headers with no separate file — simpler, but leads to bloated headers for complex templates.
- Use .cpp with explicit instantiation — avoids the separate include file but requires listing all template instantiations explicitly.
Use Cases
- Use case 1: A contributor implementing a templated utility class knows immediately how to split the declaration and implementation.
- Use case 2: A code reviewer can enforce the chosen extension via the style guide without subjective debate.
Impact
- Documentation change and potentially minor file renaming across the codebase.
- No changes to compiled output or runtime behavior.
- No breaking changes.
Implementation Details (optional)
- Investigate community standards: .inl is common in game engine codebases (Unreal uses it); .tpp is semantically clear ("template implementation"); .ipp is less common.
- Recommend .inl or .tpp based on team preference and document the rationale.
- Update the coding style guide accordingly.
Additional Context
N/A
Related Issues
Reactions are currently unavailable
Problem Statement
There is no documented standard for which file extension to use when separating template implementation from declarations (.inl, .tpp, or .ipp), nor when such files should be introduced at all. This leads to inconsistency across the codebase and confusion for contributors writing templated code.
Proposed Solution
Alternative Solutions
Use Cases
Impact
Implementation Details (optional)
Additional Context
N/A
Related Issues