made derived() private instead of protected in CRTP

This commit is contained in:
Mathew Sutcliffe
2013-04-30 20:12:47 +01:00
parent ad6ac0186b
commit e5afc2c627
3 changed files with 48 additions and 48 deletions

View File

@@ -23,6 +23,25 @@ class CMatrix3x1; // forward declaration
*/
template <class ImplVector> class CVector3DBase : public CBaseStreamStringifier<ImplVector>
{
private:
/*!
* \brief Easy access to derived class (CRTP template parameter)
* \return
*/
ImplVector const* derived() const
{
return static_cast<ImplVector const *>(this);
}
/*!
* \brief Easy access to derived class (CRTP template parameter)
* \return
*/
ImplVector* derived()
{
return static_cast<ImplVector *>(this);
}
protected:
// using own value since Qt QVector3D stores internally as float
@@ -61,24 +80,6 @@ protected:
*/
virtual QString stringForConverter() const;
/*!
* \brief Easy access to derived class (CRTP template parameter)
* \return
*/
ImplVector const* derived() const
{
return static_cast<ImplVector const *>(this);
}
/*!
* \brief Easy access to derived class (CRTP template parameter)
* \return
*/
ImplVector* derived()
{
return static_cast<ImplVector *>(this);
}
public:
// getter and setters are implemented in the derived classes