Go to the documentation of this file.00001
00006 #include<iostream>
00007 #include<my_lib/instanceof.hh>
00008 #include<my_lib/any.hh>
00009
00010
00011 struct A{
00012 virtual int toto(){
00013 return 4;
00014 }
00015 };
00016
00017 struct B : A{
00018 virtual int toto(){
00019 return 5;
00020 }
00021 };
00022
00023 using namespace my_lib;
00024
00025 int main(){
00026 A a;
00027 B b;
00028 std::cout << std::boolalpha ;
00029 std::cout << instanceof<A>(b) << std::endl;
00030 std::cout << instanceof<B>(a) << std::endl;
00031 any x(3);
00032 std::cout << any_typeof<int>(x) << std::endl;
00033 std::cout << any_cast<long>(x) << std::endl;
00034 x=12.5;
00035 std::cout << x << std::endl;
00036 x=std::string("test");
00037 std::cout << x << std::endl;
00038 }
00039