Something like ADL from C++?
Kagamin
spam at here.lot
Wed Dec 4 12:35:34 UTC 2024
```
void serialize(byte[] o, string s){}
struct MyDto
{
struct SerializerAspect
{
static void serialize(byte[] o, MyDto s){}
}
}
void serialize2(T)(byte[] o, T s) if(!is(T.SerializerAspect))
{
serialize(o,s);
}
void serialize2(T)(byte[] o, T s) if(is(T.SerializerAspect))
{
T.SerializerAspect.serialize(o,s);
}
void test()
{
byte[] o;
string a;
serialize2(o,a);
MyDto c;
serialize2(o,c);
}
```
More information about the Digitalmars-d
mailing list