r/cpp • u/According_Leopard_80 • Apr 09 '26
Writing only decoupled code
https://middleraster.github.io/DAG/HeaderOnlyNoForwardDeclarations.html
12
Upvotes
r/cpp • u/According_Leopard_80 • Apr 09 '26
View all comments
Show parent comment
1
u/Big_Target_1405 Apr 20 '26
It's more that the scope of what you can change is limited when the data layout is exposed in headers.
An ABI boundary really enforces decoupling
In my view forward declarations (of class and structs) give you type safety without exposing data structures, which is ideal.