C++ or D?

jmh530 john.michael.hall at gmail.com
Wed Dec 30 20:42:49 UTC 2020


On Wednesday, 30 December 2020 at 19:51:07 UTC, Ola Fosheim 
Grøstad wrote:
> [snip]
>
> Sort of, in C++ it would be something like this
>
> template<template<typename> class OuterName>
> void myfunction(OuterName<int> x){ stuff(); }
>
> [snip]

You mean like this

struct Foo(T)
{
     T x;
}

void foo(T : Foo!V, V)(T x) {
     import std.stdio: writeln;
     writeln("here");
}

void main() {
     Foo!int x;
     foo(x);
}


More information about the Digitalmars-d-learn mailing list