November 29, 2009 Re: Fully dynamic d by opDotExp overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen kjaeraas | Simen kjaeraas wrote:
> Just tested it - it does not seem to allow template parameters beyond just the
> function name. Is this something we can expect in the future?
> The use case I have is this:
>
> struct foo {
> void opDispatch( string name, T )( T value ) {
> static if ( is( T == float ) ) {
> // Do something
> } else static if ( T == int ){
>
> } else {
> static assert( false, "Unsupported argument type." );
> }
> }
> }
I see. That's a bug, and I'll fix it.
|
November 29, 2009 Re: Fully dynamic d by opDotExp overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile wrote:
> Can someone show me a small example of how to use it with runtime method names?
class C
{
void dynamic(string s, int i)
{
...
}
void opDispatch(string s)(int i)
{
dynamic(s, i);
}
}
|
Copyright © 1999-2021 by the D Language Foundation