2 ///Named template study
8 class AlgorithmDefaultTypes
22 template<class T = AlgorithmDefaultTypes>
23 class AlgorithmTypes : public T
31 class SetAdat : public T { X Adat; };
38 template<class T = AlgorithmTypes<> >
39 class AlgorithmDefaultDataFields : public T
46 typedef T TypeTraits; //Jo ez a nev?
52 typename T::Adat adat;
59 template<class T = AlgorithmDefaultDataFields<> >
60 class Algorithm : public T
65 Algorithm(const T &tt) : T(tt) {};
67 template<class X> class _SetAdat : public T {
72 _SetAdat() {}; //"Algorithm<>::_SetAdat<double> b;"-hez kell!!!!
73 // De az is rossz!!!!!
74 _SetAdat(const T &t,const X& x) : T(t), adat(x) {};
77 ///\name Funtion Named Parameters
86 Algorithm<_SetAdat<X> > setAdat(const X &x) {
87 return Algorithm<_SetAdat<X> >(_SetAdat<X>(*this,x));
91 ///\name Named Parameters
101 public Algorithm<AlgorithmDefaultDataFields<
102 typename T::TypeTraits::template SetAdat<X> > >
111 Algorithm &setIntAdat(int i) {_intAdat=i;return *this;}
117 Algorithm &intAdat(int i) {_intAdat=i;return *this;}
119 //Maga az algoritmus!!!!!!!
124 typename T::Adat run()
126 //Itt csinalunk valamit
132 //Itt nem csinalunk semmit
140 Algorithm<> algorithm()
142 return Algorithm<>();
150 // Algorithm<>::_SetAdat<double> b; b=b;//Ez itt nem az, amit szeretnenk!!!
153 Algorithm<>::SetAdat<double> c; //Algorithm<>::Adat<double> c; jobb vo'na
157 algorithm().setAdat(5.2).run();