Hi all,
I've been learning D for a few weeks by reading through
Programming In D [1] and had a question about Eponymous Template
section [2]. Here's the example:
```
template LargerOf(A, B) {
static if (A.sizeof < B.sizeof) {
alias LargerOf = B;
} else {
alias LargerOf = A;
}
}
On Wednesday, 12 July 2017 at 00:44:38 UTC, Deech wrote:
Hi all,
I've been learning D for a few weeks by reading through
Programming In D [1] and had a question about Eponymous
Template section [2]. Here's the example:
```
template LargerOf(A, B) {
static if (A.sizeof < B.sizeof) {
alia
Hi all,
I've been reading up on D's metaprogramming features and was
wondering if it was possible to use them to add pattern matching
to the language as a macro. The template mixin feature seems to
require putting the new syntax in strings. I was hoping there's
an alternative.
Thanks!
-deech
On Monday, 6 March 2017 at 08:27:13 UTC, David Nadlinger wrote:
On Monday, 6 March 2017 at 02:20:02 UTC, Deech wrote:
[…] add pattern matching to the language as a macro.
D doesn't have macros per se. However, template metaprogramming
and mixins can replace them in many cases.
Which particu