Commit 87ef1afb authored by Quentin Khan's avatar Quentin Khan

FCostCell: Added a trait class that allows finding out whether a class has...

FCostCell: Added a trait class that allows finding out whether a class has FCostCell in its inheritance structure.
parent 125477c1
...@@ -7,6 +7,17 @@ ...@@ -7,6 +7,17 @@
#include <type_traits> #include <type_traits>
/**
* \brief Empty trait class.
* \author Quentin Khan
*
* This class is used to check whether a cell class has FCostCell in its
* inheritance tree.
*/
class FCostCellTypeTrait {};
/** /**
* \brief Cell with a cost memory for balance computations. * \brief Cell with a cost memory for balance computations.
* \author Quentin Khan * \author Quentin Khan
...@@ -18,7 +29,7 @@ ...@@ -18,7 +29,7 @@
* \tparam CostType The type to use in order to store the cost. Defaults to FSize. * \tparam CostType The type to use in order to store the cost. Defaults to FSize.
*/ */
template<typename BaseClass, typename CostType = FSize> template<typename BaseClass, typename CostType = FSize>
class FCostCell : public BaseClass { class FCostCell : public BaseClass, virtual public FCostCellTypeTrait {
static_assert(std::is_arithmetic<CostType>::value, static_assert(std::is_arithmetic<CostType>::value,
"The cell cost type must be an arithmetic type."); "The cell cost type must be an arithmetic type.");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment