Simen kjaeraas <simen.kja...@gmail.com> wrote:

One needs to match parentheses from the last parentheses in the typeof.stringof.


string parameterNamesOf( alias fn )( ) {
    string fullName = typeof(&fn).stringof;
        
    int pos = fullName.lastIndexOf( ')' );
    int end = pos;
    int count = 0;
    do {
        if ( fullName[pos] == ')' ) {
            count++;
        } else if ( fullName[pos] == '(' ) {
            count--;
        }
        pos--;
    } while ( count > 0 );
        
    return fullName[pos+2..end];
}

--
Simen

Reply via email to