if you have a nuclear power plant and wanna compute small magic squares, then let's do it
1 class AlgorithmDefaultTypes
7 template<class T = AlgorithmDefaultTypes>
8 class AlgorithmTypes : public T
12 class SetAdat : public T { X Adat; };
15 template<class T = AlgorithmTypes<> >
16 class AlgorithmDefaultDataFields : public T
19 typename T::Adat adat;
22 template<class T = AlgorithmDefaultDataFields<> >
23 class Algorithm : public T
28 Algorithm(const T &tt) : T(tt) {};
30 template<class X> class _SetAdat : public T {
34 _SetAdat() {}; //"Algorithm<>::_SetAdat<double> b;"-hez kell!!!!
35 // De az is rossz!!!!!
36 _SetAdat(const T &t,const X& x) : T(t), adat(x) {};
40 Algorithm<_SetAdat<X> > setAdat(const X &x) {
41 return Algorithm<_SetAdat<X> >(_SetAdat<X>(*this,x));
44 Algorithm &setIntAdat(int i) {_intAdat=i;return *this;}
46 Algorithm &intAdat(int i) {_intAdat=i;return *this;}
48 typename T::Adat run()
50 //Itt csinalunk valamit
51 return typename T::Adat();
55 //Itt nem csinalunk semmit
59 Algorithm<> algorithm()
68 Algorithm<>::_SetAdat<double> b; b=b;//Ez itt nem az, amit szeretnenk!!!
70 Algorithm<>::SetAdat<double> c; c=c; //Ez itt nem az, amit szeretnenk!!!
77 algorithm().setAdat(5.2).run();