| Thread overview | |||||
|---|---|---|---|---|---|
|
June 27, 2020 mixin template compile-time compute declared name | ||||
|---|---|---|---|---|
| ||||
Want
mixin mytemplate!("foo", .............................);
to be able to declare names dependent upon the text foo in the context it is used.
For example declaring
enum x_foo = ....................................;
blah foo_value = ....................................;
.
.
.
.
Is it possible to use a template to declare something whose name is computed at compile time?
| ||||
June 27, 2020 Re: mixin template compile-time compute declared name | ||||
|---|---|---|---|---|
| ||||
Posted in reply to NonNull | On Saturday, 27 June 2020 at 21:10:59 UTC, NonNull wrote:
> Is it possible to use a template to declare something whose name is computed at compile time?
You'd have to string mixin the contents inside the mixin template.
| |||
June 27, 2020 Re: mixin template compile-time compute declared name | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Saturday, 27 June 2020 at 21:23:10 UTC, Adam D. Ruppe wrote:
> On Saturday, 27 June 2020 at 21:10:59 UTC, NonNull wrote:
>> Is it possible to use a template to declare something whose name is computed at compile time?
>
> You'd have to string mixin the contents inside the mixin template.
Worked! Thank you!!
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply