Template pattern delegate?
frame
frame86 at live.com
Sun Oct 25 11:30:43 UTC 2020
Is there a possibility to write templated code / custom trait
pattern with usage like a delegate?
I have a try-catch block with different types and don't want to
repeat myself in every method again. It's always the same, just
what's tried changes, eg.:
pseudo code:
template myStuff(mixin code)
{
try {
code();
}
catch (X e) {
...
}
catch (Y e) {
...
}
...
}
static myStuff!({
writeln("...");
});
More information about the Digitalmars-d-learn
mailing list