Changeset 1203:14f951664a63 in lemon0.x for src/work/alpar/namedparamtest4.cc
 Timestamp:
 03/07/05 08:57:06 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1615
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/alpar/namedparamtest4.cc
r1105 r1203 1 ///\file 2 ///Named template study 3 4 ///\e 5 6 ///\e 7 /// 1 8 class AlgorithmDefaultTypes 2 9 { 3 10 public: 11 ///\e 12 13 ///\e 14 /// 4 15 typedef int Adat; 5 16 }; 6 17 18 ///\e 19 20 ///\e 21 /// 7 22 template<class T = AlgorithmDefaultTypes> 8 23 class AlgorithmTypes : public T 9 24 { 10 25 public: 26 ///\e 27 28 ///\e 29 /// 11 30 template<class X> 12 31 class SetAdat : public T { X Adat; }; 13 32 }; 14 33 34 ///\e 35 36 ///\e 37 /// 15 38 template<class T = AlgorithmTypes<> > 16 39 class AlgorithmDefaultDataFields : public T 17 40 { 18 41 protected: 42 ///\e 43 44 ///\e 45 /// 46 typedef T TypeTraits; //Jo ez a nev? 47 protected: 48 ///\e 49 50 ///\e 51 /// 19 52 typename T::Adat adat; 20 53 }; 21 54 55 ///\e 56 57 ///\e 58 /// 22 59 template<class T = AlgorithmDefaultDataFields<> > 23 60 class Algorithm : public T … … 32 69 X adat; 33 70 public: 71 typedef X Adat; 34 72 _SetAdat() {}; //"Algorithm<>::_SetAdat<double> b;"hez kell!!!! 35 73 // De az is rossz!!!!! … … 37 75 }; 38 76 77 ///\name Funtion Named Parameters 78 79 ///@{ 80 81 ///\e 82 83 ///\e 84 /// 39 85 template<class X> 40 86 Algorithm<_SetAdat<X> > setAdat(const X &x) { 41 87 return Algorithm<_SetAdat<X> >(_SetAdat<X>(*this,x)); 42 88 } 89 90 ///@} 91 ///\name Named Parameters 43 92 93 ///@{ 94 95 ///\e 96 97 ///\e 98 /// 99 template<class X> 100 class SetAdat : 101 public Algorithm<AlgorithmDefaultDataFields< 102 typename T::TypeTraits::template SetAdat<X> > > 103 {}; 104 105 ///@} 106 107 ///\e 108 109 ///\e 110 /// 44 111 Algorithm &setIntAdat(int i) {_intAdat=i;return *this;} 45 112 //vagy: 113 ///Vagy 114 115 ///Vagy... 116 /// 46 117 Algorithm &intAdat(int i) {_intAdat=i;return *this;} 47 118 119 //Maga az algoritmus!!!!!!! 120 ///\e 121 122 ///\e 123 /// 48 124 typename T::Adat run() 49 125 { 50 126 //Itt csinalunk valamit 51 return typename T::Adat();127 return adat; 52 128 } 129 53 130 ~Algorithm() 54 131 { … … 57 134 }; 58 135 136 ///\e 137 138 ///\e 139 /// 59 140 Algorithm<> algorithm() 60 141 { … … 65 146 { 66 147 Algorithm<> a; 148 a.run(); 67 149 68 Algorithm<>::_SetAdat<double> b; b=b;//Ez itt nem az, amit szeretnenk!!! 150 // Algorithm<>::_SetAdat<double> b; b=b;//Ez itt nem az, amit szeretnenk!!! 151 // // b.run(); 152 153 Algorithm<>::SetAdat<double> c; //Algorithm<>::Adat<double> c; jobb vo'na 154 c.run(); 69 155 70 Algorithm<>::SetAdat<double> c; c=c; //Ez itt nem az, amit szeretnenk!!!71 72 a.run();73 // b.run();74 // c.run();75 76 156 algorithm().run(); 77 157 algorithm().setAdat(5.2).run();
Note: See TracChangeset
for help on using the changeset viewer.