Re: importing std.array: empty in a struct messes things up

2018-03-04 Thread arturg via Digitalmars-d-learn
On Sunday, 4 March 2018 at 20:07:06 UTC, visitor wrote: On Sunday, 4 March 2018 at 19:53:59 UTC, ag0aep6g wrote: On 03/04/2018 08:45 PM, ag0aep6g wrote: I don't know what's going on here. The error message doesn't make sense to me. Might be a bug in the compiler. This one works: struct

Re: importing std.array: empty in a struct messes things up

2018-03-04 Thread visitor via Digitalmars-d-learn
On Sunday, 4 March 2018 at 19:53:59 UTC, ag0aep6g wrote: On 03/04/2018 08:45 PM, ag0aep6g wrote: I don't know what's going on here. The error message doesn't make sense to me. Might be a bug in the compiler. This one works: struct Stack(T) { T[] stack; alias stack this; bool

Re: importing std.array: empty in a struct messes things up

2018-03-04 Thread arturg via Digitalmars-d-learn
I had the same issue, happens with any conflicting selective import. It seems to work if you dont use selective imports, but importing it inside the function if possible is a better option.

Re: importing std.array: empty in a struct messes things up

2018-03-04 Thread ag0aep6g via Digitalmars-d-learn
On 03/04/2018 08:45 PM, ag0aep6g wrote: I don't know what's going on here. The error message doesn't make sense to me. Might be a bug in the compiler. This one works: struct Stack(T) { T[] stack; alias stack this; bool empty() {return empty(stack);} /* not using UFCS */ im

Re: importing std.array: empty in a struct messes things up

2018-03-04 Thread ag0aep6g via Digitalmars-d-learn
On 03/04/2018 08:17 PM, Dennis wrote: I was making a stack interface for an array: ``` struct Stack(T) {     import std.array: empty;     T[] stack;     alias stack this; } void main() {     Stack!int stack;     bool x = stack.empty; } ``` My expectation is that you can now call `empty` on

importing std.array: empty in a struct messes things up

2018-03-04 Thread Dennis via Digitalmars-d-learn
I was making a stack interface for an array: ``` struct Stack(T) { import std.array: empty; T[] stack; alias stack this; } void main() { Stack!int stack; bool x = stack.empty; } ``` My expectation is that you can now call `empty` on a stack instance since I imported it in the