Skip to content

Commit

Permalink
Update Dev Notes
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Nov 6, 2024
1 parent bf3579e commit f3edf73
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions DEVELOPER-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,25 @@ public:
* It lowers the number of heap allocations, because it allocates larger blocks of space to store multiple `HalfEdge` objects.
* It handles the lifecycle of the `HalfEdge` objects that make up the `EdgeGraph`, because when the `EdgeGraph` is deallocated, the `std::deque<>` and all its contents are also automatically deallocated.
### Use forward declarations in header files
Where possible, in header files use **forward declarations** rather than header includes.
This cuts the include dependency chain, which reduces the recompilation required when a low-level class header changes.
Includes are only needed where the class contents are referred to, not just the class name.
E.g. use this
```
namespace geos {
namespace geom {
class Geometry;
}
}
```
rather than:
```
#include <geos/geom/Geometry.h>
```
### Use `pragma once` to limit header inclusion
Use `#pragma once` to limit header inclusion. It is simpler and faster.

0 comments on commit f3edf73

Please sign in to comment.