I have two structs that serve roughly the same purpose, and I would like one to be accepted when the other is declared as a function parameter.

To better understand what I mean, take the following example, where I have a function, and two structs.
```
struct typeA {
    // Some member variables here
}

struct typeB {
// Some similar member variables here, but in a different format
}

float someFunction(typeB input) {
    // Does some stuff
    // Returns result
}
```

If I want to be able to call `someFunction` (or any function with `TypeB` as a parameter) using `TypeA` in place of `TypeB`, and I'm willing to modify the definition of `TypeA`, I know that I can add an `opCast` and `alias this = opCast!TypeB` to `TypeA`.

But what if `typeA` is in an external library? Is there any way I can get `someFunction` (and any function with a `typeB` parameter) to accept `typeA`, only modifying the definition of `TypeB` (and possibly adding a single global line in it's module)?

Reply via email to