membres statiques est spécialisations partielles de classes

A

AG

Bonjour,

voici mon bout de code (toujours le même en amélioré). Ma question est la
suivante :

combien de tableau tab ai-je ? Moi j'en veux que deux. Un pour myA1 et un
pour myA2. Le fait que je sois obligé de spécialiser l'instanciation du
tableau statique tab me fait penser que j'aurais 12 tableau en tout. Est-ce
bien ça ?

D'avance merci.

Alexandre.


#define D 5

const int L=10;

template <class T,bool S,int N=0> class A
{
static T tab[D*L];
A<T,S,N+1> next;
public:
void f(void)
{
for(int i=0;i<L;i++) tab[N*L+i+1]+=tab[N*L+i];
next.f();
};
};

template<class T,bool S> class A<T,S,D>
{
static T tab[D*L];
public:
void f(void)
{
for(int i=0;i<S;i++) tab[D*L+i+1]+=tab[D*L+i];
};
};


template<class T, bool S,int N>
T A<T,S,N>::tab[D*L]={0};

template<class T, bool S>
T A<T,S,D>::tab[D*L]={0};

int main(void)
{
A<int,true> myA1;
A<int,false> myA2
myA1.f();
myA2.f();
}
 
K

Keith Thompson

AG said:
Bonjour,
Hello.

voici mon bout de code (toujours le même en amélioré). Ma question est la
suivante :
[...]
template <class T,bool S,int N=0> class A
{
static T tab[D*L];
A<T,S,N+1> next;
public:
[...]

This newsgroup uses English. You might want one of the fr.*
newsgroups. Or, if your English is good enough, try comp.lang.c++;
your code is C++, not C.
 
A

AG

Keith Thompson said:
This newsgroup uses English. You might want one of the fr.*
newsgroups. Or, if your English is good enough, try comp.lang.c++;
your code is C++, not C.

thank you Keith for the answer. I made a mystake sending my post.
Tried to cancel the post, but apparently it didn't work. My
appologies.

AG.
 
K

Keith Thompson

AG said:
thank you Keith for the answer. I made a mystake sending my
post. Tried to cancel the post, but apparently it didn't work. My
appologies.

No problem. Cancels typically don't work; they're not authenticated,
and forged cancels have caused most servers to ignore all cancels.
 
T

Tim Prince

AG said:
thank you Keith for the answer. I made a mystake sending my post. Tried
to cancel the post, but apparently it didn't work. My appologies.

It did cancel on my newsgroup server. Just curious, do French speaking
newsgroups have grammatical standards?
 
K

Keith Thompson

Tim Prince said:
It did cancel on my newsgroup server.

Cancels are done by sending a specially formatted article. Probably
your server accepted it and tried to pass it on to other servers, but
other servers ignored it.

The solution is to think before you post (a rule I don't always follow
myself).
Just curious, do French
speaking newsgroups have grammatical standards?

I think you've managed to find *exactly* the wrong place to ask that
question. :cool:}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,835
Latest member
lila30

Latest Threads

Top