C++ 为什么这是一个编译器错误?(g+;+;)

C++ 为什么这是一个编译器错误?(g+;+;),c++,g++,compiler-errors,C++,G++,Compiler Errors,所以我试图在我的实用程序类中使用一个泛型比较函子 我试图给它下定义,并这样称呼它 template <class T> bool AVL_tree<T>::avl_insert(AVL_Node<T> *& top, const AVL_Node<T> * insertNode, bool & taller) { std::binary_function<T,T,bool>::first_argument_typ

所以我试图在我的实用程序类中使用一个泛型比较函子

我试图给它下定义,并这样称呼它

template <class T>
bool AVL_tree<T>::avl_insert(AVL_Node<T> *& top, const AVL_Node<T> * insertNode, bool & taller) {
    std::binary_function<T,T,bool>::first_argument_type insertNodeValue;
    insertNodeValue  = insertNode->data;
    std::binary_function<T,T,bool>::second_argument_type topValue;
    topValue = insertNode->data;
    std::binary_function<T,T,bool>::result_type cmp_result;
    cmp_result = comparer(insertNodeValue,topValue);
    std::binary_function<T,T,bool>::result_type cmp_result2;
    cmp_result2 = comparer(topValue,insertNodeValue);
    //Function continues from here
}
模板
布尔AVL_树::AVL_插入(AVL_节点*&顶部,常量AVL_节点*插入节点,布尔和更高){
std::二进制函数::第一个参数\类型insertNodeValue;
insertNodeValue=insertNode->data;
std::二进制函数::第二个参数类型topValue;
topValue=插入节点->数据;
std::二进制函数::结果类型cmp\U结果;
cmp_结果=比较器(insertNodeValue,topValue);
std::二进制函数::结果类型cmp\U结果2;
cmp_result2=比较器(topValue,insertNodeValue);
//功能从此处继续
}
预期会出现特定的编译器错误;插入节点值之前

topValue和cmp_结果重复此错误

我真的不明白为什么这是一个语法错误,我正在处理这个引用:

它是一个从属名称,因此需要
typename
关键字:

typename std::binary_function<T,T,bool>::first_argument_type insertNodeValue;
typename std::binary\u函数::第一个参数\u类型insertNodeValue;

其他人也是如此。请参阅。

鉴于这些是依赖类型,您的第一步可能是添加
typename

typename std::binary_function<T,T,bool>::first_argument_type insertNodeValue;
typename std::binary\u函数::第一个参数\u类型insertNodeValue;

为什么会这样:
标准::二进制函数::第一个参数类型
?而不仅仅是
T