Added support for custom functors as cfunctions. Unfortunately, they require explicit template instantiation...:(