IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage C++ Discussion :

Appel recursif avec template


Sujet :

Langage C++

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut Appel recursif avec template
    il y a t il un probleme a ecrire:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    # ifndef _Tensor
    # define _Tensor
     
    #include <math.h>
     
     
    template< class U,int n>
    class Tensor{
    public:
     
    	Tensor();
    	~Tensor(); 	
     
    public:
    Tensor<U,n-1> operator () ( const int & aLine, const int & aElem );
     
    public:
    	int              Dim;
    	int	*NbElem;
    	U	*pTensor;
     
    };
     
     
    #include "Tensor.cpp"
     
    # endif

  2. #2
    Membre actif
    Profil pro
    Inscrit en
    Août 2003
    Messages
    247
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2003
    Messages : 247
    Points : 276
    Points
    276
    Par défaut
    Aucun problèmes. A condition de spécialiser un template pour une valeur donnée pour arrèter à temps la récursion. Attention aussi au temp de compilation qui peut s'alonger considérablement.

    Je te renvoie à ceci : http://loulou.developpez.com/tutoriels/cpp/metaprog/

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    J ai lu ton line sur les templates
    C et excellent
    Merci beaucoup
    je vais essayer de bien le comprendre et l assimiler

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Février 2003
    Messages
    311
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2003
    Messages : 311
    Points : 337
    Points
    337
    Par défaut
    Quel est l'intérêt de cette ligne à la fin de ton fichier?


  5. #5
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Citation Envoyé par zoubidaman
    Quel est l'intérêt de cette ligne à la fin de ton fichier?

    http://c.developpez.com/faq/cpp/?pag...VERS_templates

  6. #6
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    J ai lu attentivement un papier sur le site http://www.developpez.net/forums/vie...6310ad5fafa18b
    concernant la meta programmation
    j ai du mal a saisir un point. .. c est la description de l arborescence p12

    BinaryOp<
    BinaryOp<
    Vector::const_iterator, ...

    je vois bien que ca représente l operation qu il veut realiser mais je ne comprends pas comment il va l utiliser

  7. #7
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    Je souhaiterai que la construction de Tensor<U,n-1> se fasse sans encombre et de manière minimale. Sinon il ne parvient pas a complier
    En ecrivant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    template <class U,int n> class Tensor ; 
     
    template <class U> Tensor<U,0>{ Dim=0;};
    je pensais resoudre le problème mais j ai eu syntax error: '<end Parse>'

    Qui a une idée?

    voici le code complet



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    # ifndef _TENSOR
    # define _TENSOR
     
     
     
    #include <math.h>
    #include <vector>
    #include <iostream>
     
    using namespace std;
     
    template <class U,int n> class Tensor ; 
     
    template <class U> Tensor<U,0>{ Dim=0;};
     
     
    template< class U, int n>
    class Tensor{
     
    typedef std::vector<int>			VI;
    typedef std::vector<U>				VU;
     
    public:
    	Tensor(const VI		& vNbElem_);
    	Tensor(const int	& NbElem_);
    	Tensor(const VI		& vNbElem_,	const VU  vTensor_); 
    	Tensor(const int	& NbElem_,	const VU  vTensor_);
    	Tensor(const vector<Tensor<U,n-1> >	& vTensor_){};
     
    	Tensor(){};
    	~Tensor(){};
     
    	void Init	(const int * pNbElem_);
     
    public:
    	int						Dim;
    	int						NbElemSize;
    	VI						vNbElem;	
    	VU						vTensor;
    	VI::iterator			ItNbElem;
    	VU::iterator			ItTensor;
     
    };
     
     
     
    #include "Tensor.cpp"
    # endif

  8. #8
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    voici un code que je trouve plus juste mais qui me donne une erreur C2935: template-class-id redefined as a global function

    Je cherche juste a arreter les appels recursifs au constructeur vide à la declaration de la méthode:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Tensor(const vector<Tensor<U,n-1> >	& vTensor_){};
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
     
    # ifndef _TENSOR
    # define _TENSOR
     
     
     
    #include <math.h>
    #include <vector>
    #include <iostream>
     
    using namespace std;
     
     
     
     
    template< class U, int n>
    class Tensor{
     
    typedef std::vector<int>			VI;
    typedef std::vector<U>				VU;
     
    public:
    	Tensor(const VI		& vNbElem_);
    	Tensor(const int	& NbElem_);
    	Tensor(const VI		& vNbElem_,	const VU  vTensor_); 
    	Tensor(const int	& NbElem_,	const VU  vTensor_);
    	Tensor(const vector<Tensor<U,n-1> >	& vTensor_){};
     
    	Tensor(){};
    	~Tensor(){};
     
    	void Init	(const int * pNbElem_);
     
    public:
    	int						Dim;
    	int						NbElemSize;
    	VI						vNbElem;	
    	VU						vTensor;
    	VI::iterator			ItNbElem;
    	VU::iterator			ItTensor;
     
    };
     
    template <class U> inline Tensor<U,0>(){};
     
    #include "Tensor.cpp"
    # endif

  9. #9
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Ta spécialisation de Tensor pour N = 0 ressemble à une fonction qui n'aurait pas de valeur de retour, alors que Tensor est une classe. Pour spécialiser une classe, il faut la réécrire complètement. Ceci-dit je ne suis pas sûr que ce soit la meilleure solution à ton problème. D'ailleurs je n'arrive pas à voir pourquoi ton constructeur pose un problème de récursion ?

  10. #10
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    la methode
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Tensor(const vector<Tensor<U,n-1> >	& vTensor_);
    me pose un sérieux probleme il génére ce message d erreur:

    c:\math\toto\tensor.cpp(57) : error C2995: 'Tensor<U,n>::Tensor<U,n>' : template function has already been defined
    c:\math\toto\tensor.h(45) : see declaration of 'Tensor<U,n>::Tensor<U,n>'
    je ne sais pas comment l interpreter

  11. #11
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    je précise que cette méthode est un constructeur
    donc quand il est appelé, il appelle le constructeur de rang n-1 qui appelle celui de n-2 etc..
    C est pour ca qu il faut fixer un debut pour la chaine

  12. #12
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    je ne vois pas comment ecrire uen classe pour n=0 sans qu il me dise que cette casse existe deja.
    Je suis dans la ....!

  13. #13
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut exemple factoriel
    un exemple de recursion de class pour le calcul du factoriel
    que me proposez vous comme classe de rang n=0?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    template<int n>
    class Factoriel{
     
    public:	
    	Factoriel(){};
    	~Factoriel(){};
    	int Fact(){ Factoriel<n-1> a; return Dim*a.Fact();	};
    };
     
     
    int main(int argc, char* argv[])
    {
     
    Factoriel<3> u;
    cout<< u.Fact()<<"\n";
    	return 0;
    };

  14. #14
    Membre régulier
    Profil pro
    Étudiant
    Inscrit en
    Juin 2004
    Messages
    68
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juin 2004
    Messages : 68
    Points : 86
    Points
    86
    Par défaut Re: exemple factoriel
    Citation Envoyé par Math75
    un exemple de recursion de class pour le calcul du factoriel
    que me proposez vous comme classe de rang n=0?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    template<int n>
    class Factoriel{
     
    public:	
    	Factoriel(){};
    	~Factoriel(){};
    	int Fact(){ Factoriel<n-1> a; return Dim*a.Fact();	};
    };
     
     
    int main(int argc, char* argv[])
    {
     
    Factoriel<3> u;
    cout<< u.Fact()<<"\n";
    	return 0;
    };
    je dirais mais je ne suis pas expert en template:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    template<int n>
    class Factoriel{
     
    public:	
    	Factoriel(){};
    	~Factoriel(){};
    	int Fact(){ Factoriel<n-1> a; return n*a.Fact();	};
    };
     
    class Factoriel<0>{
     
    public:	
    	Factoriel(){};
    	~Factoriel(){};
    	int Fact(){ return 1;	};
    };
     
     
    int main(int argc, char* argv[])
    {
     
    Factoriel<3> u;
    cout<< u.Fact()<<"\n";
    	return 0;
    };
    attention je n'ai pas testé ce code

  15. #15
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    c:\math\toto\tensor.cpp(57) : error C2995: 'Tensor<U,n>::Tensor<U,n>' : template function has already been defined
    c:\math\toto\tensor.h(45) : see declaration of 'Tensor<U,n>::Tensor<U,n>'
    Il y a quoi aux lignes 57 et 45 ?

    je précise que cette méthode est un constructeur
    donc quand il est appelé, il appelle le constructeur de rang n-1 qui appelle celui de n-2 etc..
    C est pour ca qu il faut fixer un debut pour la chaine
    Je ne pense pas. Il va au pire appeler le constructeur par copie pour construire un Tensor<U, n - 1>, et non ce même constructeur. Donc pas de récursion.

    un exemple de recursion de class pour le calcul du factoriel
    que me proposez vous comme classe de rang n=0?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    template<int n>
    class Factoriel{
     
    public:   
       Factoriel(){}
       ~Factoriel(){}
       int Fact(){ Factoriel<n-1> a; return Dim*a.Fact();   }
    };
     
    template<>
    class Factoriel<0>{
     
    public:   
       Factoriel(){}
       ~Factoriel(){}
       int Fact(){ return 1; }
    };
     
    int main(int argc, char* argv[])
    {
     
    Factoriel<3> u;
    cout<< u.Fact()<<"\n";
       return 0;
    };
    (au fait, les ';' après accolade fermante de fonction sont inutiles)

  16. #16
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    ce code marche

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    template< int n> 
    class Factoriel{ 
     
    public:    
       Factoriel(){}; 
       ~Factoriel(){}; 
       double Fact(){ Factoriel<n-1> a; return n*a.Fact();   }; 
    }; 
     
    class Factoriel<0>
    {
    public:	int Fact() { return 1; }
    } ; 
     
    int main(int argc, char* argv[]) 
    { 
     
    Factoriel<10> u; 
    cout<< u.Fact()<<"\n"; 
       return 0; 
    };
    mais celui ci ne marche pas car la class 0 est encore une template avez vous une idée?

    using namespace std;

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    template< class U, int n> class Tensor;
     
    template<class U>
    class Tensor<U,0>{
    public:
    	Tensor(){};
    	~Tensor(){};
    };
     
     
     
    template< class U, int n>
    class Tensor{
     
    public:
    	Tensor(){};
    	~Tensor(){};
    public:
    	Tensor(const vector<Tensor<U,n-1> >      & vTensor_)[};
    };
     
     
     
     
     
     
    int main(int argc, char* argv[])
    {
    Tensor<double,5>			toto;
    vector<Tensor<double,4> >	tata;
    Tensor<double,5>			titi(tata);
     
    	return 0;
    };

  17. #17
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    mais celui ci ne marche pas car la class 0 est encore une template avez vous une idée?
    Chez moi ça fonctionne parfaitement. Précise exactement les erreurs que tu obtiens, ça ira plus vite.

    Et comme je te l'ai déjà expliqué, il n'y a même pas besoin de créer la spécialisation pour 0 car le problème que tu décris au niveau du constructeur n'existe pas. En tout cas ça marche également, après test. Après peut-être qu'un problème peut venir d'un bout de code que tu ne nous aurais pas montré.

  18. #18
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    le code suivant marche a merveuille:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
     
    template<int n> 
    class Factoriel{ 
     
    public:    
       Factoriel(){} 
       ~Factoriel(){} 
       int Fact(){ Factoriel<n-1> a; return n*a.Fact();   } 
    }; 
     
     
    class Factoriel<0>{ 
     
    public:    
       Factoriel(){} 
       ~Factoriel(){} 
       int Fact(){ return 1; } 
    }; 
     
    int main(int argc, char* argv[]) 
    { 
     
     
    Factoriel<3> u; 
    cout<< u.Fact()<<"\n"; 
       return 0; 
    } 
     
    #endif



    Celui-ci en revannche me donne ce message d erreur:


    error C2989: 'Tensor<U,0>' : template class has already been defined as a non-template class
    c:\math\toto\toto.cpp(34) : error C2988: unrecognizable template declaration/definition

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
     
    template< class U, int n> 
    class Tensor{ 
     
    public: 
       Tensor(){}; 
       ~Tensor(){}; 
    public: 
       Tensor(const vector<Tensor<U,n-1> >      & vTensor_){}; 
    }; 
     
    template< class U > 
    class Tensor<U,0 > 
    { 
    public: 
       Tensor(){}; 
       ~Tensor(){}; 
    }; 
     
     
     
     
    int main(int argc, char* argv[]) 
    { 
     
    Tensor<double,5>         toto; 
    vector<Tensor<double,4> >   tata; 
    Tensor<double,5>         titi(tata); 
     
       return 0; 
    } ; 
    #endif
    Vous conviendez que c est déroutant!

  19. #19
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    error C2989: 'Tensor<U,0>' : template class has already been defined as a non-template class
    c:\math\toto\toto.cpp(34) : error C2988: unrecognizable template declaration/definition
    Est-ce que tu nous montre là tout le code ?

    Et est-ce que tu as essayé sans cette spécialisation qui je te le rappelle ne sert apparemment à rien ? ... Si cela ne fonctionne pas, peux-tu préciser les erreurs ?

  20. #20
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Août 2004
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 85
    Points : 35
    Points
    35
    Par défaut
    en effet ca marche si j'écris le constructeur explicitement dans la classe. Neanmoins voici des lignes de code qui donne a reflechir et qui ne compile bien sure:


    C:\PROG\PROG.cpp(24) : error C2989: 'Fact<0,m>' : template class has already been defined as a non-template class
    C:\PROG\PROG.cpp(24) : error C2988: unrecognizable template declaration/definition
    C:\PROG\PROG.cpp(33) : error C2989: 'Fact<n,0>' : template class has already been defined as a non-template class
    C:\PROG\PROG.cpp(33) : error C2988: unrecognizable template declaration/definition
    Error executing cl.exe.
    le code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
     
    #include "stdafx.h"
    #include <iostream>
     
    template <int n, int m>
    class Fact{
    public:
    	Fact(){cout<<"Appel"<<n<<" : "<<m<<endl;};
    	~Fact(){};
    	int F(){	Fact<n-1,m-1> a; return n*m*a.F();	};
    };
     
    template<int m>
    class Fact<0,m>{
    public:
    	Fact(){cout<<"Appel"<<0<<" : "<<m<<endl;};
    	~Fact(){};
    	int F(){ Fact<0,m-1> a;	return m*a.F();	};
     
    };
     
    template<int n>
    class Fact<n,0>{
    public:
    	Fact(){cout<<"Appel"<<n<<" : "<<0<<endl;};
    	~Fact(){};
    	int F(){ Fact<n-1,0> a;	return n*a.F();	};
     
    };
     
    class Fact<0,0>{
    public:
    	Fact(){cout<<"Appel"<<0<<" : "<<0<<endl;};
    	~Fact(){};
    	int F(){ 	return 1;	}
     
    };
     
     
    int main(int argc, char* argv[])
    {
     
    Fact<5,2> A;
    cout<<"Le resultat est : " <<A.F()<<"\n";
     
     
    	return 0;
    };

Discussions similaires

  1. Appel recursif au constructeur
    Par Math75 dans le forum C++
    Réponses: 1
    Dernier message: 11/10/2005, 15h48
  2. appel d un template mais sans etre ds le bon node
    Par luta dans le forum XSL/XSLT/XPATH
    Réponses: 4
    Dernier message: 15/09/2005, 15h46
  3. Echec d'un appel distant avec RPC
    Par hasan dans le forum MFC
    Réponses: 3
    Dernier message: 18/05/2005, 06h42
  4. Conversion avec template
    Par indy2 dans le forum Langage
    Réponses: 10
    Dernier message: 23/03/2005, 00h02
  5. [C#][WebServices] Appel methode avec une classe en paramètre
    Par bran_noz dans le forum Windows Forms
    Réponses: 6
    Dernier message: 10/09/2004, 16h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo