By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,828 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,828 IT Pros & Developers. It's quick & easy.

membres statiques est spécialisations partielles de classes

P: n/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=0class A
{
static T tab[D*L];
A<T,S,N+1next;
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 Sclass 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,truemyA1;
A<int,falsemyA2
myA1.f();
myA2.f();
}
Aug 10 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"AG" <ag@tb.frwrites:
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=0class A
{
static T tab[D*L];
A<T,S,N+1next;
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.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 10 '07 #2

P: n/a
AG
"Keith Thompson" <ks***@mib.orga écrit dans le message de news:
ln************@nuthaus.mib.org...
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.

Aug 13 '07 #3

P: n/a
"AG" <ag@tb.frwrites:
"Keith Thompson" <ks***@mib.orga écrit dans le message de news:
ln************@nuthaus.mib.org...
>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.
No problem. Cancels typically don't work; they're not authenticated,
and forged cancels have caused most servers to ignore all cancels.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 13 '07 #4

P: n/a
AG wrote:
"Keith Thompson" <ks***@mib.orga écrit dans le message de news:
ln************@nuthaus.mib.org...
>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.
It did cancel on my newsgroup server. Just curious, do French speaking
newsgroups have grammatical standards?
Aug 13 '07 #5

P: n/a
AG
It did cancel on my newsgroup server. Just curious, do French speaking
newsgroups have grammatical standards?
no idea.
Aug 13 '07 #6

P: n/a
Tim Prince <ti***********@sbcglobal.netwrites:
[snip]
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. 8-)}

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 13 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.