digitalmars.D.learn - template parameters
- Charles Hixson (12/12) Aug 29 2021 I've set up a class template (so far untested) thus:
I've set up a class template (so far untested) thus: class AARL (T, ndx = "ndx") if (isIntegral(T.init.ndx) ) If I'm correct, this should work for ndx an integer variable of T, but I'd really like T to be able to be anything which can be stored both in an array and in an associative array. But I can't figure out how to specify ndx. After all, T might be a float, so it wouldn't have any appropriate attributes. And I'd also like ndx to be able to be a function either a member of the class/struct T or a stand alone function. So how should I set up this template? -- Javascript is what you use to allow third part programs you don't know anything about and doing you know not what to run on your computer.
Aug 29 2021