accessing numeric template parameters
Dominikus Dittes Scherkl via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Nov 3 06:27:46 PST 2014
If I have a struct with numeric template parameter, how can I
access it within member functions? Like normal member variables?
And how about the constructor?
struct polynomial(uint base)
{
private:
uint[] N;
public:
this(uint x) { base = x; }
...
void add(Polynomial!base P)
{
if(N.length < P.N.length) N.length = P.N.length;
foreach(i; 0..P.N.length)
{
N[i] = (N[i]+P.N[i]) % base;
}
}
}
This doesn't work for me :-/
More information about the Digitalmars-d-learn
mailing list