Windreamer Is Not a DREAMER
main(){main(puts("Hello,stranger!"));}
主要喜欢他的语法着色功能,真的很方便,RSS等方面的功能也很全面......

测试一下:

//////////////////////////////
//Prime.cpp
//////////////////////////////

template
<int Val>
struct IntType
{
 
const static int value = Val ;
}
;
template
<bool flag, typename T, typename U>
struct Select
{
 typedef T Result;
}
;

template
<typename T, typename U>
struct Select<false, T, U>
{
 typedef U Result;
}
;
template 
<unsigned int N,unsigned int x>
struct FindRoot
{
 
const static int value=Select<(N/x)==x||((N/x+x)/2==x),IntType<x>,FindRoot<N,(N/x+x)/2> >::Result::value;
}
;

template 
<unsigned int N>
struct Sqrt
{
 
const static int value=FindRoot<N,N/2>::value;
}
;

template 
<>
struct Sqrt<0> ;

template 
<int N,int divider>
struct TestPrime
{
 
const static int value=Select<(N%divider)==0,IntType<0>,TestPrime<N,divider-1> >::Result::value;
}
;

template 
<int N>
struct TestPrime<N,1>
{
 
const static int value=1;
}
;

template 
<unsigned int N>
struct IsPrime
{
 
const static int value=TestPrime<N,Sqrt<N>::value+1>::value;
}
;

template 
<>
struct IsPrime<2>
{
 
const static int value=1;
}
;

template 
<>
struct IsPrime<1>;

int printf(const char*,);

int main()
{
 
const int yes=IsPrime<123127>::value;
 printf(
"%d\n",yes);
}

posted on 2005-12-05 09:45 Windreamer Is Not DREAMER 阅读(342) 评论(1)  编辑 收藏 引用 所属分类: 杂谈
Comments
  • # re: 把我的技术博客放在在这里了
    leedsmark
    Posted @ 2006-02-27 21:25
    太ym了,而且狂赞你的blog标题
    not a dreamer, but a practiser~~  回复  更多评论   

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理