On 3/13/25 5:14 PM, Emma wrote:
> but the below fails with a “undefined identifier 'S'” error!
[...]
> bool foo(T)(T it) {
> static if (is(T == X.Foo!S, string S)) {
Here is another solution that uses std.traits:
import std.traits;
struct X {
struct Foo(string S) {}
}
bool foo(T)(T i
On Friday, 14 March 2025 at 00:14:35 UTC, Emma wrote:
Hello, I was doing some template nonsense and came across this
weird issue. This compiles fine:
```d
struct Foo(string S) {}
bool foo(T)(T it) {
static if (is(T == Foo!S, string S)) {
return true;
} else {
return fal
Hello, I was doing some template nonsense and came across this
weird issue. This compiles fine:
```d
struct Foo(string S) {}
bool foo(T)(T it) {
static if (is(T == Foo!S, string S)) {
return true;
} else {
return false;
}
}
void main() {
foo(Foo!"x"());
}
```
b
On Wednesday, March 12, 2025 12:07:04 PM MDT Manfred Nowak via
Digitalmars-d-learn wrote:
> On Tuesday, 11 March 2025 at 16:56:28 UTC, WhatMeWorry wrote:
> [...]
> > To include the upper bound value, use a square bracket "]" at
> > the end of the range."
>
> [...]
> > foreach( i, e; a[0..3] )
> >