1 // This file is part of the ustl library, an STL implementation.
3 // Copyright (C) 2005 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
11 { cout
.format ("PrintInt %d\n", v
); }
13 { cout
.format ("PrintShort %d\n", v
); }
15 { cout
.format ("PrintFloat %.2f\n", v
); }
18 class Derived
: public Base
{ };
20 void TestTypelists (void)
22 cout
<< "----------------------------------------------------------------------\n"
23 " Testing functionality from typet.h\n"
24 "----------------------------------------------------------------------\n";
26 cout
.format ("sizeof(NullType) = %zu\n", sizeof(nullType
));
27 cout
.format ("Int2Type(42)::value = %d\n", Int2Type
<42>::value
);
28 Type2Type
<int>::OriginalType t2tiv
= 56;
29 cout
.format ("Type2Type type value = %d\n", t2tiv
);
31 cout
<< "int == int is " << bool(IsSameType
<int, int>::value
) << endl
;
32 cout
<< "float == int is " << bool(IsSameType
<float, int>::value
) << endl
;
34 Print (Select
<Conversion
<long,int>::exists2Way
, int, float>::Result(567));
35 cout
<< "Base is SuperSubclass from Derived is " << bool(SuperSubclass
<Base
,Derived
>::value
) << endl
;
36 cout
<< "Base is SuperSubclass from Base is " << bool(SuperSubclass
<Base
,Base
>::value
) << endl
;
37 cout
<< "Base is SuperSubclassStrict from Derived is " << bool(SuperSubclassStrict
<Base
,Derived
>::value
) << endl
;
38 cout
<< "Base is SuperSubclassStrict from Base is " << bool(SuperSubclassStrict
<Base
,Base
>::value
) << endl
;
40 cout
<< "\n----------------------------------------------------------------------\n"
41 " Testing functionality from typelist.h\n"
42 "----------------------------------------------------------------------\n";
43 typedef tl::Seq
<char, int, short, long>::Type IntTypesList
;
44 typedef tl::Seq
<float, double>::Type FloatTypesList
;
45 cout
.format ("Length of IntTypesList is %d\n", tl::Length
<IntTypesList
>::value
);
46 Print (tl::TypeAt
<IntTypesList
, 2>::Result(1234));
47 Print (tl::TypeAtNonStrict
<FloatTypesList
, 0, int>::Result(1235));
48 Print (tl::TypeAtNonStrict
<FloatTypesList
, 2, short>::Result(1236));
49 typedef tl::Append
<IntTypesList
, FloatTypesList
>::Result AllTypesList
;
50 cout
.format ("Index of double in AllTypesList is %d\n", tl::IndexOf
<AllTypesList
,double>::value
);
51 typedef tl::Erase
<AllTypesList
, float>::Result NoFloatList
;
52 cout
.format ("Index of float in NoFloatList is %d\n", tl::IndexOf
<NoFloatList
,float>::value
);
53 cout
.format ("Index of double in NoFloatList is %d\n", tl::IndexOf
<NoFloatList
,double>::value
);
54 typedef tl::Reverse
<AllTypesList
>::Result ReversedList
;
55 cout
.format ("Index of double in ReversedList is %d\n", tl::IndexOf
<ReversedList
,double>::value
);
58 StdBvtMain (TestTypelists
)