C++ C++;编译错误C4430

C++ C++;编译错误C4430,c++,c++14,C++,C++14,代码显示了两个基于模板的函数,它们看起来很好。它们都有相同的语法,但只有一个是有效的。我一直在尝试不同类型的实现,但没有一种能与第一种实现兼容。在你问之前:我找不到任何能帮助我的解决方案 但是,请看一下代码: #pragma once #include <exception> #include <iostream> #ifdef WIN32 #include <Windows.h> #endif //WIN32 #include <string>

代码显示了两个基于模板的函数,它们看起来很好。它们都有相同的语法,但只有一个是有效的。我一直在尝试不同类型的实现,但没有一种能与第一种实现兼容。在你问之前:我找不到任何能帮助我的解决方案

但是,请看一下代码:

 #pragma once

#include <exception>
#include <iostream>
#ifdef WIN32
#include <Windows.h>
#endif //WIN32
#include <string>

namespace util {

    /* ############### */
    /* #             # */
    /* # For strings # */
    /* #             # */
    /* ############### */



    template<class T = std::string>
    bool hasPrefix(const T& string, const, T& prefix);

    template<class T = std::string>
    bool hasPostfix(const T& string, const T& postfix);

}

template<class T>
bool util::hasPrefix(const T& string, const T& prefix) {
     //CODE
}

template<class T>
bool util::hasPostfix(const T& string, const T& prefix) {
    //CODE
}
#pragma一次
#包括
#包括
#ifdef WIN32
#包括
#endif//WIN32
#包括
命名空间util{
/* ############### */
/* #             # */
/*#对于字符串#*/
/* #             # */
/* ############### */
模板
布尔hasPrefix(常量T和字符串、常量、T和前缀);
模板
布尔有后缀(常量T和字符串,常量T和后缀);
}
模板
bool util::hasPrefix(常量T和字符串,常量T和前缀){
//代码
}
模板
bool util::hasPostfix(常量T和字符串、常量T和前缀){
//代码
}
现在,当我尝试编译时,Visual Studio会出现以下错误:

错误C4430:缺少类型说明符-假定为int

但只适用于hasPrefix(…),而不适用于hasPostfix(…)! 我尝试在没有静态断言(…)或for(…)循环的情况下实现它。 更改标题或其他任何东西都没有帮助,我必须承认,这个错误对我来说毫无意义,因为第二个模板函数工作得非常好

我希望有人能帮助我

模板
template<class T = std::string>
bool hasPrefix(const T& string, const, T& prefix);
//                                   ^
布尔hasPrefix(常量T和字符串、常量、T和前缀); // ^
多注意你正在做的事情


简单地看一下有效的声明和无效的声明,打字错误是显而易见的。

谢谢,我怎么能看不到呢/