예제 #1
0
파일: meta1.cpp 프로젝트: bbsekiya/ichiro
int main()
{
   
   std::cout << abs2<3>::value << std::endl;
   
   std::cout << abs2<-10>::value << std::endl;
 
   std::cout << "gcd2<M,N>::value = " << gcd2<48, 36>::value << std::endl;
   
   
   std::cout << "std::is_void<int>::value = " << std::is_void<int>::value << std::endl;
   
   std::cout << "std::is_void<void>::value = " << std::is_void<void>::value << std::endl;

   //std::cout << "std::is_void<int> = " << std::is_void<int> << std::endl;
   
   static_assert(std::is_same<myVec<int>, std::vector<int> >::value, "not same");
   
   myVec<int>     x = {1,2,3,4};
   g(x);
   
   foo(10);
   foo(std::string("XX"));
   std::string s("AAA");
   foo(s);
   foo("aaa");
   
   uint32_t    a1 = 100u;
   
   std::array<int, 10> a100 = {1,2,3,4,5,6,7,8,9,10};
   
   foo10(a100);
   
   std::array<std::string, 10> a200 = {"aaa", "bbb"};
   foo10(a200);
   
   
   //foo20( +[](double x, double y)->double { return x*x + y; });
   

   
   return 0;
}
예제 #2
0
int main ()
{
  if (foo1 (0x13) != 8)
    abort();

  if (foo2 (0x06) != 27)
    abort();

  if (foo3 (0x02) != 4)
    abort();

  if (foo4 (0x01) != 7)
    abort();

  if (foo5 (0x15) != 65)
    abort();

  if (foo6 (0x103) != 8)
    abort();

  if (foo7 (0x04) != 21)
    abort();

  if (foo8 (0x07) != 72)
    abort();

  if (foo9 (0x10000011L) != 0)
    abort();

  if (foo10 (0x1000105L) != 0)
    abort();

  if (foo11 (0x1000008L) != 39)
    abort();

  if (foo12 (0x1000004L) != 0)
    abort();

  if (foo13 (0x109LL) != 0)
    abort();

  if (foo14 (0x108LL) != 39)
    abort();

  if (foo15 (0x1000001LL) != 7)
    abort();

  if (foo16 (0x100000004LL) != 21)
    abort();

  return 0;
}
int use10() { foo10(); } /* { dg-warning "previous implicit declaration" } */