在这段代码中:
诠释.h:
#include <type_traits>
#include "Best_Fit.h"
template<class Int_T, typename Best_Fit<Int_T>::type Min_Range,typename Best_Fit<Int_T>::type Max_Range>
class Int_Core
{//If I move this class to a separate header I'm getting aforementioned error
};
template<class Int_T, typename Best_Fit<Int_T>::type Min_Range, typename Best_Fit<Int_T>::type Max_Range>
class Int : private Int_Core<Int_T,Min_Range,Max_Range>
{
};
Best_Fit.h:
struct Signed_Type
{
typedef long long type;
};
struct Unsigned_Type
{
typedef unsigned long long type;
};
template<bool Cond, class First, class Second>
struct if_
{
typedef typename First::type type;
};
template<class First, class Second>
struct if_<false,First,Second>
{
typedef typename Second::type type;
};
template<class Int_T>
struct Best_Fit
{
typedef typename if_<std::is_signed<Int_T>::value,Signed_Type,Unsigned_Type>::type type;
};
主.cpp:
#include <iostream>
using namespace std;
#include "Int.h"
int main(int argc, char* argv[])
{
return 0;
}
错误:
error: expected nested-name-specifier before 'Best_Fit'|
我正在用 gcc 4.6.1 编译它有什么
理由不能将 Int_Core 放在单独的头文件中?