Bind C++ template specialized with void parameter

Gregor Mückl gregormueckl at gmx.de
Wed Feb 28 22:48:33 UTC 2024


I have roughly the following code in C++ (vastly simplified from 
reality):

```cpp
template<typename T>
class Wrapper {
private:
   T t;
   bool valid;

public:
   bool isValid() { return valid; }
};


template<>
class Wrapper\<void> {
private:
   bool valid;

public:
   bool isValid() { return valid; }
};
```

I can bind Wrapper\<T> from D with no problem:

```d

extern(C++, class)
class Wrapper(T) {
   private T t;
   private bool valid;
   public final isValid();
}

```

But how can I bind Wrapper\<void> in D? Specifically, how do I 
even express that template specialization in D syntax?

Gregor


More information about the Digitalmars-d-learn mailing list