Files Classes Functions Hierarchy
00001 #include <cassert> 00002 #include <iostream> 00003 using namespace std; 00004 00005 #include <policyselector.h> 00006 #include <policydefault.h> 00007 00008 void test01() 00009 { 00010 cout << "Test 1" << endl; 00011 cout << "Testing the default policy" << endl; 00012 policyselector<> app; 00013 cout << endl << endl; 00014 } 00015 00017 class policy2new 00018 { 00019 public: 00020 00021 void print() const 00022 { cout << "policy2new" << endl; } 00023 00024 policy2new() 00025 { print(); } 00026 }; 00027 00028 void test02() 00029 { 00030 cout << "Test 2" << endl; 00031 cout << "Overriding the 2nd policy with policy2new" << endl; 00032 // policyselector< policyov2< policy2new, policydefault > > app; 00033 policyselector< policyov2< policy2new > > app; 00034 cout << endl << endl; 00035 } 00036 00037 00038 void test03() 00039 { 00040 cout << "Test 3" << endl; 00041 cout << "Default template argument overloading" << endl << endl; 00042 00043 00044 cout << "A silly example because there are only 3 tempate arguments" << endl; 00045 cout << " For templates with 5,6,+ arguments this may be useful." << endl; 00046 cout << endl; 00047 00048 cout << "Overloading the 2nd policy with policy4, then overloading" << endl; 00049 cout << " the first policy with policy5." << endl; 00050 00051 policyselector< policyov1< policy5, policyov2< policy4, policydefault > > > app; 00052 cout << endl << endl; 00053 } 00054 00055 00056 00057 int main(int argc, char** agv) 00058 { 00059 test01(); 00060 test02(); 00061 test03(); 00062 00063 return 0; 00064 } 00065 00066
1.5.8