Ok, so with the test case sorted, how am I supposed to return the map over
member function calls?
Peter Alexander:
> That said, I have managed to create a slightly more complex example that
> *does* break.
I have simplified your test case a little:
import std.algorithm: map;
struct Bar {
float[1] m;
this(float a) { m[0] = a; }
}
class Foo {
Bar[1] m;
this(Bar a) { m[0] =
== Quote from bearophile (bearophileh...@lycos.com)'s article
> But that code works with dmd 2.049:
> ...
> Bye,
> bearophile
You're right!
That makes things even more curious then. I had noticed the problem in some
more complex code
and just assumed it would be the same in the simple code that
Peter Alexander:
> class Foo
> {
> int[] data;
>
> int foo(int i) { return data[i]; }
>
> auto allFoo()
> {
> auto fun = (int i) { return foo(i); };
> // alternatively: auto fun = &this.foo; (same result)
> return map!(fun)(iota(data.length));
> }
> }
>
> This compiles, bu
This post has two questions:
1. What are the semantics of 'alias' template parameters when initialised using
runtime functions,
e.g.:
class Foo
{
int[] data;
int foo(int i) { return data[i]; }
auto allFoo()
{
auto fun = (int i) { return foo(i); };
// alternatively: auto fun = &