Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 10, 2016 [Issue 12680] isIterable fails for types with disabled postblit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12680 Lars T. Kyllingstad <bugzilla@kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@kyllingen.net Resolution|--- |INVALID --- Comment #1 from Lars T. Kyllingstad <bugzilla@kyllingen.net> --- The example code you posted most definitely should not compile because S is not iterable. I guess you forgot the opApply() or range primitives. The following code *does* compile successfully: import std.traits; struct OpApply { @disable this(this); int opApply(int delegate(ref uint) dg) { assert(0); } } struct Range { @disable this(this); @property uint front() { assert(0); } void popFront() { assert(0); } enum bool empty = false; } static assert (isIterable!OpApply); static assert (isIterable!Range); -- |
February 11, 2016 [Issue 12680] isIterable fails for types with disabled postblit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12680 ZombineDev <petar.p.kirov@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |petar.p.kirov@gmail.com Resolution|INVALID |--- -- |
February 11, 2016 [Issue 12680] isIterable fails for types with disabled postblit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12680 --- Comment #2 from ZombineDev <petar.p.kirov@gmail.com> --- @Lars T. Kyllingstad The OP is not trying to iterate over the struct, but over an array of structs with @disabled this(this). -- |
February 11, 2016 [Issue 12680] isIterable fails for types with disabled postblit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12680 --- Comment #3 from Lars T. Kyllingstad <bugzilla@kyllingen.net> --- Ah, sorry, I didn't notice the brackets. Well, then I guess it's more a question of how you define "a foreach loop with a single loop variable of automatically inferred type", as it is specified in the documentation. This does not work: S[10] arr; foreach (s; arr[]) { } This does work, however: foreach (ref s; arr[]) { } Since the documentation doesn't say anything explicitly about ref, I'm inclined to think that isIterable works as intended. Maybe we need an isRefIterable template too. -- |
December 17, 2022 [Issue 12680] isIterable fails for types with disabled postblit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12680 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation