mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 09:54:16 +08:00
replaced "clone" with "derived" in CRTP (more usual, more flexible, more clear in its intent, and avoids copying the object twice on compilers that don't optimise return by value)
This commit is contained in:
@@ -60,12 +60,21 @@ protected:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Polymorphic clone as concrete class
|
||||
* \brief Easy access to derived class (CRTP template parameter)
|
||||
* \return
|
||||
*/
|
||||
PQ clone() const
|
||||
PQ const* derived() const
|
||||
{
|
||||
return static_cast<PQ const &>(*this);
|
||||
return static_cast<PQ const *>(this);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Easy access to derived class (CRTP template parameter)
|
||||
* \return
|
||||
*/
|
||||
PQ* derived()
|
||||
{
|
||||
return static_cast<PQ *>(this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user