Assigning to array of structs with custom constructor

Salih Dincer salihdb at hotmail.com
Tue Apr 26 04:32:54 UTC 2022


😀

So the problem is that the structure is not in the inter-module 
space

On Monday, 25 April 2022 at 16:11:47 UTC, rassoc wrote:
> 
> This works:
>
> ```d
> import std;
>
> void main() {
>     struct Foo { string s; }
>     Foo[] arr = ["abc", "def", "ghi"].map!Foo.array;
>     arr.writeln; // => [Foo("abc"), Foo("def"), Foo("ghi")]
> }
> ```

If ```sruct Foo {}``` is not taken outside of ```main()``` it 
will fail for many possibilities!

**For example:**
> Error: cannot access frame pointer of `source.main.Foo`

SDB at 79


More information about the Digitalmars-d-learn mailing list