|
-
November 13th, 2008, 03:59 PM
#1
A const problem
is there a power function that is concidered const? like a^2?
my problem is:
const int a=2;
char b[a];
double b[pow(2,a)];
this is not possible since pow is not const, now 2*a will work (if that is what you want) but power operation doesn't since there is no operator that is concidered constant by the compiler (I guess), is there a solution for this other than:
const int a=2;
const int b=4;
double a[b];
my real code is here:
Code:
template <int branchOutNum=2,int k=1,int n=3> // note branchOutNum=2^k is a must
class viterbiState
{
viterbiState *states[branchOutNum];
char input[n];
char estimate[k];
viterbiState(){}
};
so I need both k and 2^k (banchOut) and it is a must that branchOut=2^k, so I just would need the user to enter them as so, otherwise I'm in trouble, and I think thats not good programming.
so any ideas to solve this one?
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|