On Tuesday, 14 December 2021 at 08:12:04 UTC, zoujiaqing wrote:
My code:

```D
module http.HttpRequest;

import std.container;
import std.array : Appender;

struct HttpRequest
{
    struct Header()
    {
        Appender!string name;
        Appender!string value;
    }

    string method;
    string uri;
    int versionMajor = 0;
    int versionMinor = 0;
    Array!Header headers;
    ubyte[] content;
    bool keepAlive = false;
}
```

Error code:
```D
source/http/HttpRequest.d(18,5): Error: struct `std.container.array.Array` does not match any template declaration
```

the problem is that your header is a template, so you need to instantiate it:
```d
Array!(Header!()) headers;
```

the error message is kinda poor here.

Alternatively, remove the template `()` from your `struct Header`

Reply via email to