import std.stdio;
import std.conv;
void main() {
int i;
try {
readf("%d\n", &i); // "a"
} catch (ConvException e) {
auto s = readln();
writeln(s); // "aa", "aaa" or SEGV ???
}
}
https://wandbox.org/permlink/NMYNjpOgQtfUprBQ
I just want to retry reading if
On Wednesday, 27 June 2018 at 02:39:49 UTC, Shigeki Karita wrote:
import std.stdio;
import std.conv;
void main() {
int i;
try {
readf("%d\n", &i); // "a"
} catch (ConvException e) {
auto s = readln();
writeln(s); // "aa", "aaa" or SEGV ???
}
}
https://wan
https://dpaste.dzfl.pl/cd605899d050
why this code cannot convert to foreach (over Structs and Classes
with Ranges).
auto h = new BinaryHeap!(int[])(new int[0]);
typeof(h).stringof.writeln;
static assert(isInputRange!(typeof(h)));
h.insert(3);
h.insert(1);
h.insert(2);
Oh, struct/class semantics really confuses me!
Why is local struct visible in this outer template, while local
class is not?
https://wandbox.org/permlink/MfsDa68qgaMSIr4a
https://dlang.org/spec/template.html#instantiation_scope
---
enum p(T) = __traits(compiles, new T());
class GlobalC {}
struct GlobalS {}
void main()
{
class LocalC
On Monday, 11 May 2020 at 15:29:53 UTC, Steven Schveighoffer
wrote:
On 5/11/20 11:11 AM, Shigeki Karita wrote:
[...]
First, it actually does compile, I think because the compiler
recognizes that LocalS is POD (plain old data), without
methods, so it doesn't need a context pointer.
e.g.:
a
On Monday, 11 May 2020 at 16:10:36 UTC, Steven Schveighoffer
wrote:
On 5/11/20 11:40 AM, Shigeki Karita wrote:
On Monday, 11 May 2020 at 15:29:53 UTC, Steven Schveighoffer
wrote:
[...]
Thanks for your answer. Now I understand that POD matters here.
When I add a dtor: `struct LocalS { ~this()