// This file is part of the uSTL library, an STL implementation. // // Copyright (c) 2005 by Mike Sharov // This file is free software, distributed under the MIT License. #include "stdtest.h" using namespace tm; void Print (int v) { cout.format ("PrintInt %d\n", v); } void Print (short v) { cout.format ("PrintShort %d\n", v); } void Print (float v) { cout.format ("PrintFloat %.2f\n", v); } class Base { }; class Derived : public Base { }; void TestTypelists (void) { cout << "----------------------------------------------------------------------\n" " Testing functionality from typet.h\n" "----------------------------------------------------------------------\n"; NullType nullType; cout.format ("sizeof(NullType) = %zu\n", sizeof(nullType)); cout.format ("Int2Type(42)::value = %d\n", Int2Type<42>::value); Type2Type::OriginalType t2tiv = 56; cout.format ("Type2Type type value = %d\n", t2tiv); cout << "int == int is " << bool(IsSameType::value) << endl; cout << "float == int is " << bool(IsSameType::value) << endl; Print (Select::exists2Way, int, float>::Result(567)); cout << "Base is SuperSubclass from Derived is " << bool(SuperSubclass::value) << endl; cout << "Base is SuperSubclass from Base is " << bool(SuperSubclass::value) << endl; cout << "Base is SuperSubclassStrict from Derived is " << bool(SuperSubclassStrict::value) << endl; cout << "Base is SuperSubclassStrict from Base is " << bool(SuperSubclassStrict::value) << endl; cout << "\n----------------------------------------------------------------------\n" " Testing functionality from typelist.h\n" "----------------------------------------------------------------------\n"; typedef tl::Seq::Type IntTypesList; typedef tl::Seq::Type FloatTypesList; cout.format ("Length of IntTypesList is %d\n", tl::Length::value); Print (tl::TypeAt::Result(1234)); Print (tl::TypeAtNonStrict::Result(1235)); Print (tl::TypeAtNonStrict::Result(1236)); typedef tl::Append::Result AllTypesList; cout.format ("Index of double in AllTypesList is %d\n", tl::IndexOf::value); typedef tl::Erase::Result NoFloatList; cout.format ("Index of float in NoFloatList is %d\n", tl::IndexOf::value); cout.format ("Index of double in NoFloatList is %d\n", tl::IndexOf::value); typedef tl::Reverse::Result ReversedList; cout.format ("Index of double in ReversedList is %d\n", tl::IndexOf::value); } StdBvtMain (TestTypelists)