[Lemon-commits] [lemon_svn] alpar: r1615 - hugo/trunk/src/work/alpar

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:46:35 CET 2006


Author: alpar
Date: Mon Mar  7 08:57:06 2005
New Revision: 1615

Modified:
   hugo/trunk/src/work/alpar/named-param-test4.cc

Log:
Nothing special

Modified: hugo/trunk/src/work/alpar/named-param-test4.cc
==============================================================================
--- hugo/trunk/src/work/alpar/named-param-test4.cc	(original)
+++ hugo/trunk/src/work/alpar/named-param-test4.cc	Mon Mar  7 08:57:06 2005
@@ -1,24 +1,61 @@
+///\file 
+///Named template study
+
+///\e
+
+///\e
+///
 class AlgorithmDefaultTypes 
 {
 public:
+///\e
+
+///\e
+///
   typedef int Adat;
 };
 
+///\e
+
+///\e
+///
 template<class T = AlgorithmDefaultTypes>
 class AlgorithmTypes : public T 
 {
 public:
+///\e
+
+///\e
+///
   template<class X>
   class SetAdat : public T { X Adat; };
 };
 
+///\e
+
+///\e
+///
 template<class T = AlgorithmTypes<> >
 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 T = AlgorithmDefaultDataFields<> >
 class Algorithm : public T
 {
@@ -31,31 +68,75 @@
     protected:
     X adat;
     public:
+    typedef X Adat;
     _SetAdat() {}; //"Algorithm<>::_SetAdat<double> 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<class X>
   Algorithm<_SetAdat<X> > setAdat(const X &x) {
     return Algorithm<_SetAdat<X> >(_SetAdat<X>(*this,x));
   }
+
+  ///@}
+  ///\name Named Parameters
   
+  ///@{
+
+  ///\e
+  
+  ///\e
+  ///
+  template<class X>
+  class SetAdat :
+    public Algorithm<AlgorithmDefaultDataFields<
+    typename T::TypeTraits::template SetAdat<X> > >
+  {};
+  
+  ///@}  
+
+///\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 typename T::Adat();    
+    return adat;    
   }
+
   ~Algorithm()
   {
     //Itt nem csinalunk semmit
   }
 };
 
+///\e
+
+///\e
+///
 Algorithm<> algorithm() 
 {
   return Algorithm<>();
@@ -64,15 +145,14 @@
 int main() 
 {
   Algorithm<> a;
-
-  Algorithm<>::_SetAdat<double> b; b=b;//Ez itt nem az, amit szeretnenk!!! 
-
-  Algorithm<>::SetAdat<double> c; c=c; //Ez itt nem az, amit szeretnenk!!!
-
   a.run();
-  //  b.run();
-  //  c.run();
+
+//   Algorithm<>::_SetAdat<double> b; b=b;//Ez itt nem az, amit szeretnenk!!! 
+//   //  b.run();
   
+  Algorithm<>::SetAdat<double> c; //Algorithm<>::Adat<double> c; jobb vo'na
+  c.run();
+
   algorithm().run();
   algorithm().setAdat(5.2).run();
 }



More information about the Lemon-commits mailing list