几周前我开始使用模板,但使用它时遇到问题。 我得到这个错误:模板类中定义的类型“不命名类型”
自由式/ _gl /../_ convection_selective/Definitions.h:153:9:错误:Node_handle'在“Point_set {又名结构Kd_tree_patch>> *,My_point_property_map,CGAL :: Search_traits>>,常量双*,Construct_coord_iterator>>>}” 没有指定类型
在编译的代码:
“Definitions.h”:
#include "Kd_tree_patch.h"
[...]
template <class SearchTraits, class Splitter_= CGAL::Sliding_midpoint<SearchTraits>, class UseExtendedNode = CGAL::Tag_true > class Kd_tree_patch; //forward declaration
typedef Kd_tree_patch<Search_traits> Point_set;
typedef Point_set::Node_handle Node_handle;
“Kd_tree_patch.h”:
template <class SearchTraits, class Splitter_=Sliding_midpoint<SearchTraits>, class UseExtendedNode = Tag_true >
class Kd_tree_patch {
[...]
typedef Kd_tree_node<SearchTraits, Splitter, UseExtendedNode > Node;
typedef typename Compact_container<Node>::iterator Node_handle;
};
为什么Node_handle不被视为一种类型了吗?
感谢您的帮助。
你缺少一个'typename'存在(这是一个依赖型)... – Nim
你开始几周前使用模板?啊呀。 – Salgar
@NIm你的意思是:typedef typename Point_set :: Node_handle Node_handle;如果是这样,我尝试了,但我得到了同样的错误。 – Kamouth