Possible?

Bill Baxter wbaxter at gmail.com
Fri Nov 13 14:51:26 PST 2009


On Fri, Nov 13, 2009 at 1:11 PM, Ary Borenszweig <ary at esperanto.org.ar> wrote:
> How can I know at compile time if all of the following are true for a given
> symbol s:
>  1. s is a function
>  2. the return type is a class that extends from class foo.Bar
>  3. the function has three arguments and it is not variadic
>  4. the first argument is an int
>  5. the second argument is a struct
>  6. the third argument is an associative array with char[] key and float
> value

For a question like that you should definitely specify whether you
want D1 or D2.

Also do you really want to know if "s is a function"?  Or if "s is
something which can be called like a function".  If the latter then
you should test if call syntax compiles like Jacob suggested.  If not
then I think you use "if(is(s == function))" like Simen said.

--bb


More information about the Digitalmars-d-learn mailing list