J
jc
Hi all,
I have a data type to use that I can't modify its codes.
E.g. This template data type is data_type. When I declare a variable of
this data_type, I write as following:
data_type(8, 2) x; // Declare a data_type variable
Someone can confirm me that arguments in template data types must be
defined at compile time, like (8,2 in this example)?
Now I want to use variables for arguments, e.g:
data_type(M, N) y; // Use variables to define data_type arguments
In the second example, It doesn't work when compiling. In order to
correct it, I can define constants M, N before:
#define M 8
#define N 2
Please tell me how can I do if I want to pass variables without
defining them.
Thanks
I have a data type to use that I can't modify its codes.
E.g. This template data type is data_type. When I declare a variable of
this data_type, I write as following:
data_type(8, 2) x; // Declare a data_type variable
Someone can confirm me that arguments in template data types must be
defined at compile time, like (8,2 in this example)?
Now I want to use variables for arguments, e.g:
data_type(M, N) y; // Use variables to define data_type arguments
In the second example, It doesn't work when compiling. In order to
correct it, I can define constants M, N before:
#define M 8
#define N 2
Please tell me how can I do if I want to pass variables without
defining them.
Thanks