Cleanup: Add static assert for tree-view getter template
These kind of static asserts for the base type of a template parameter are useful, and can avoid wrong API usage.
This commit is contained in:
@@ -455,6 +455,8 @@ inline ItemT &TreeViewItemContainer::add_tree_item(Args &&...args)
|
|||||||
|
|
||||||
template<class TreeViewType> TreeViewType &AbstractTreeViewItemDropController::tree_view() const
|
template<class TreeViewType> TreeViewType &AbstractTreeViewItemDropController::tree_view() const
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_base_of<AbstractTreeView, TreeViewType>::value,
|
||||||
|
"Type must derive from and implement the AbstractTreeView interface");
|
||||||
return static_cast<TreeViewType &>(tree_view_);
|
return static_cast<TreeViewType &>(tree_view_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user