doc, wifi: (fixes #1158) Reintroduce WifiPpdu's destructor due to PIMPL

Also add reference explaining why declaring a default destructor in the header is a problem
This commit is contained in:
Gabriel Ferreira
2025-05-06 14:41:21 +02:00
parent 7394a00d6a
commit 3a930cd85c
3 changed files with 13 additions and 1 deletions

View File

@@ -1512,6 +1512,16 @@ for more details.
- Avoid declaring trivial destructors, to optimize performance.
.. _When an empty destructor is required: https://andreasfertig.com/blog/2023/12/when-an-empty-destructor-is-required/
- When declaring default destructors with ``~Class() = default;``, be aware
that classes derived from ``SimpleRefCount<T>`` must have this declaration
on the source file (``.cc``). The header file (``.h``) should contain
the plain destructor declaration ``~Class();``. This is due to PIMPL's
opaque pointer, as explained in Andrea Fertig's blog post
`When an empty destructor is required`_.
See class WifiPpdu's destructor for an example.
C++ standard
============

View File

@@ -100,6 +100,8 @@ WifiPpdu::WifiPpdu(const WifiConstPsduMap& psdus,
m_psdus = psdus;
}
WifiPpdu::~WifiPpdu() = default;
const WifiTxVector&
WifiPpdu::GetTxVector() const
{

View File

@@ -73,7 +73,7 @@ class WifiPpdu : public SimpleRefCount<WifiPpdu>
/**
* Destructor for WifiPpdu.
*/
virtual ~WifiPpdu() = default;
virtual ~WifiPpdu();
/**
* Get the TXVECTOR used to send the PPDU.