![]() |
#2
lixang2007-09-28 21:20
|
#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>();
}