Functional template approach for visitor directive.