3 ms·
Where are we with modules, isn't pimpl there largely to avoid costs related to including the world? I was pondering on why he was putting the defaulted methods
by whizzter 3mo ago
Where are we with modules, isn't pimpl there largely to avoid costs related to including the world?
I was pondering on why he was putting the defaulted methods in the cpp, any particular reasons?
I did realize that the indirect version is required to be in the cpp since the header won't know how to copy without knowing the definition of the impl class.
- ghosty141 3mo agopimpl helps more since its trivially implementable in existing codebases while modules are a much bigger pain.
- cemdervis 3mo agopimpl also helps to keep data structure layout stable, e.g. Qt's d-pointer convention
- knorker 3mo agopimpl also makes it much easier to make changes without breaking ABI. E.g. shared libraries.
- pjmlp 3mo agoEven with modules, if you expose such types over the ABI, naturally the machine code memory layout will change, this is an issue regardless of the language.
- binary132 3mo agoThe article explains why, indirect and unique_ptr are templated and require the complete definition of the type, and the default impls of those methods use methods of the templated types.