diff -r ee5959aa4410 -r c280de819a73 src/work/alpar/named-param-test4.cc --- a/src/work/alpar/named-param-test4.cc Sun Apr 17 18:57:22 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -///\file -///Named template study - -///\e - -///\e -/// -class AlgorithmDefaultTypes -{ -public: -///\e - -///\e -/// - typedef int Adat; -}; - -///\e - -///\e -/// -template -class AlgorithmTypes : public T -{ -public: -///\e - -///\e -/// - template - class SetAdat : public T { X Adat; }; -}; - -///\e - -///\e -/// -template > -class AlgorithmDefaultDataFields : public T -{ -protected: -///\e - -///\e -/// - typedef T TypeTraits; //Jo ez a nev? -protected: -///\e - -///\e -/// - typename T::Adat adat; -}; - -///\e - -///\e -/// -template > -class Algorithm : public T -{ - int _intAdat; -public: - Algorithm() {}; - Algorithm(const T &tt) : T(tt) {}; - - template class _SetAdat : public T { - protected: - X adat; - public: - typedef X Adat; - _SetAdat() {}; //"Algorithm<>::_SetAdat b;"-hez kell!!!! - // De az is rossz!!!!! - _SetAdat(const T &t,const X& x) : T(t), adat(x) {}; - }; - - ///\name Funtion Named Parameters - - ///@{ - - ///\e - - ///\e - /// - template - Algorithm<_SetAdat > setAdat(const X &x) { - return Algorithm<_SetAdat >(_SetAdat(*this,x)); - } - - ///@} - ///\name Named Parameters - - ///@{ - - ///\e - - ///\e - /// - template - class SetAdat : - public Algorithm > > - {}; - - ///@} - -///\e - -///\e -/// - Algorithm &setIntAdat(int i) {_intAdat=i;return *this;} - //vagy: -///Vagy - -///Vagy... -/// - Algorithm &intAdat(int i) {_intAdat=i;return *this;} - - //Maga az algoritmus!!!!!!! -///\e - -///\e -/// - typename T::Adat run() - { - //Itt csinalunk valamit - return adat; - } - - ~Algorithm() - { - //Itt nem csinalunk semmit - } -}; - -///\e - -///\e -/// -Algorithm<> algorithm() -{ - return Algorithm<>(); -} - -int main() -{ - Algorithm<> a; - a.run(); - -// Algorithm<>::_SetAdat b; b=b;//Ez itt nem az, amit szeretnenk!!! -// // b.run(); - - Algorithm<>::SetAdat c; //Algorithm<>::Adat c; jobb vo'na - c.run(); - - algorithm().run(); - algorithm().setAdat(5.2).run(); -}