This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: default int paramters ignored?
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: nbecker at hns dot com (Neal D. Becker)
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 10 Jul 2002 16:42:41 -0400
- Subject: Re: default int paramters ignored?
yes, it is because you are using default template parameters wrong.
The fix is to add `<>' to Rnd.
The following code works:
template<int shift=1>
class Rnd {
inline int Compute (int x) {
return x >> shift;
}
};
main() {
Rnd<1> a; //<<== OK
Rnd<> b; //<< OK too now adding <>
}
Thanks,
Andrew Pinski