Hi,
Why doesn't this work? Seems like it should:
enum {
A = 1,
version(xx) {
B = 2
}
}
void main() {
}
Compilation output:
/d732/f174.d(5): Error: basic type expected, not version
/d732/f174.d(5): Error: no identifier for declarator int
/d732
On Saturday, 9 January 2016 at 12:43:32 UTC, Øivind wrote:
Hi,
Why doesn't this work? Seems like it should:
enum {
A = 1,
version(xx) {
B = 2
}
}
It's not allowed in the grammar but I agree with you, it could be
useful. Recent example where it could
On Saturday, 9 January 2016 at 12:43:32 UTC, Øivind wrote:
Why doesn't this work? Seems like it should:
D defines version to only work on *complete* blocks. You're
trying to use it on a partial block there.
You'll have to try something else. Perhaps copying the whole enum
in the different
on a partial block there.
>
> You'll have to try something else. Perhaps copying the whole enum
> in the different version blocks
Yeah. That's what we do in core.time.ClockType. You have to duplicate the
entire enum for each version with each enum declaration listing exactly
which me
On Fri, 30 Oct 2009 06:38:44 -0500, Ary Borenszweig a...@esperanto.org.ar
wrote:
Phil Deets wrote:
On Thu, 29 Oct 2009 18:28:12 -0500, Ary Borenszweig
a...@esperanto.org.ar wrote:
Ellery Newcomer wrote:
Unfortunately, that's going to be about the best you can do, unless
you're willing
Hi, is there a way to add members to an enum based on conditional
compilation symbols. I tried
enum Tag {
A, B,
version (symbol) {
C, D,
}
E,
}
but it doesn't work. I know I could do
version (symbol) {
enum Tag { A, B, C, D, E }
} else {
enum Tag { A, B, E }
}
but I
Phil Deets wrote:
Hi, is there a way to add members to an enum based on conditional
compilation symbols. I tried
enum Tag {
A, B,
version (symbol) {
C, D,
}
E,
}
but it doesn't work. I know I could do
version (symbol) {
enum Tag { A, B, C, D, E }
} else
Ellery Newcomer wrote:
Phil Deets wrote:
Hi, is there a way to add members to an enum based on conditional
compilation symbols. I tried
enum Tag {
A, B,
version (symbol) {
C, D,
}
E,
}
but it doesn't work. I know I could do
version (symbol) {
enum Tag { A, B, C, D, E
,
}
but it doesn't work. I know I could do
version (symbol) {
enum Tag { A, B, C, D, E }
} else {
enum Tag { A, B, E }
}
but I don't want to do that since in my case, there can be quite a few
elements outside of the version, and I don't want to repeat them all.
Unfortunately, that's going
Phil Deets wrote:
Hi, is there a way to add members to an enum based on conditional
compilation symbols. I tried
enum Tag {
A, B,
version (symbol) {
C, D,
}
E,
}
but it doesn't work. I know I could do
version (symbol) {
enum Tag { A, B, C, D, E }
} else
know I could do
version (symbol) {
enum Tag { A, B, C, D, E }
} else {
enum Tag { A, B, E }
}
but I don't want to do that since in my case, there can be quite a few
elements outside of the version, and I don't want to repeat them all.
template Version(char[] ident)
{
mixin(`version
11 matches
Mail list logo