Moving template implementation to .tpp #65

Closed
opened 2020-05-04 16:28:34 +02:00 by muellerr · 2 comments
Owner

When writing template classes, function have to be implemented directly in the header.
However, it is still possible to separate the interface (declarations) from the implementation by using a neat trick. I made use of this to make the interface to separate the local pool declarations from the implementation.

Trick taken from: https://stackoverflow.com/questions/495021/why-can-templates-only-be-implemented-in-the-header-file

If using eclipse, this is useful: https://blog.roland-speith.de/?p=1066

IMPORTANT: *.tpp is chosen for a reason, its not a source file. naming it to *.cpp might lead to the build system doing things it should not do

This is not a regular source file. The file is simply included at the end of the header and is still a part of the header. It's just a nice trick to separate interface from implementation.

When writing template classes, function have to be implemented directly in the header. However, it is still possible to separate the interface (declarations) from the implementation by using a neat trick. I made use of this to make the interface to separate the local pool declarations from the implementation. Trick taken from: https://stackoverflow.com/questions/495021/why-can-templates-only-be-implemented-in-the-header-file <br> If using eclipse, this is useful: https://blog.roland-speith.de/?p=1066 IMPORTANT: *.tpp is chosen for a reason, its not a source file. naming it to *.cpp might lead to the build system doing things it should not do This is not a regular source file. The file is simply included at the end of the header and is still a part of the header. It's just a nice trick to separate interface from implementation.
muellerr added the
feature
bug
labels 2020-05-04 16:30:13 +02:00
Owner

I like the idea of separating those in two files but I don't see this as a bug.

I like the idea of separating those in two files but I don't see this as a bug.
gaisser removed the
bug
label 2020-05-05 20:10:16 +02:00
gaisser reopened this issue 2020-06-04 14:30:36 +02:00
Author
Owner

Was implemented for some storagemanager clases now

Was implemented for some storagemanager clases now
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: fsfw/fsfw#65
No description provided.