模板出错误了!请大虾帮忙!
#include<iostream>using namespace std;
template< class T>
struct S
{
template< bool Cmd>
class Select { };
template<>
class Select<true>
{
static void sta1() {cout<<"this is Sta1"<<endl;}
public:
static void f(){ sta1(); }
};
template<>
class Select<false>
{
static void sta2() {cout<<"this is Sta2"<<endl;}
public:
static void f(){ sta2(); }
};
};
template<bool cmd>
void execute() { Select<cmd>::f();}
int main()
{
execute<sizeof(int)==4>();
}