Template function alias that leaves out the last type parameter
Adam D Ruppe
destructionator at gmail.com
Tue Sep 27 23:18:06 UTC 2022
On Tuesday, 27 September 2022 at 22:39:52 UTC, torhu wrote:
> How would I achieve something like this, do I have to turn the
> aliases into functions?
You can write it out long-form with two steps like this:
---
template _messageBox(string title, int style)
{
void _messageBox(T...)(T args)
{
import std.format;
string s = format("%s", args);
/* etc... */
}
}
alias _messageBox!("lol", 4) info;
alias _messageBox!("Warning", 4) warning;
alias _messageBox!("Error", 4) error;
void main() {
info(4, "ok");
}
---
More information about the Digitalmars-d-learn
mailing list