Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Function Literal Assignment

Part of FunctionLiteralsCategory

Description

Function Literals enable embedding anonymous functions directly into expressions.

Example

int function(char c) fp;

void main() 
{ 
    static int foo(char c) 
    { 
        return 6; 
    } 
    fp = &foo;

    printf("%d", fp('A')); 
}

Source

Based on http://www.prowiki.org/wiki4d/wiki.cgi?DWiki/FunctionLiterals which was copied from http://dlanguage.netunify.com/11 (dead link).

Link http://www.dsource.org/tutorials/index.php?show_example=77
Posted by jcc7
Date/Time Mon Mar 14, 2005 11:12 pm