我创建了一个实现Atkin筛选以找到素数的类.该类存储结果并提供"isPrime"方法.我还想添加一个范围,允许您迭代质数.我在考虑这样的事情:
@property auto iter() { return filter!(this.isPrime)(iota(2, max, 1)); }
Run Code Online (Sandbox Code Playgroud)
不幸的是,这不起作用:
Error: function primes.primes.isPrime (ulong i) is not callable using argument types ()
Error: expected 1 function arguments, not 0
Run Code Online (Sandbox Code Playgroud)
没有"这个"我得到了
Error: this for isPrime needs to be type primes not type Result
Run Code Online (Sandbox Code Playgroud)
有没有办法将成员函数作为模板参数传递?
d ×1