Hi Irek,
I am confused, because you wrote

> I need to provide different implementations of foo for different types

and 

> it would be more generic to provide a single function implementation

which I find contradictory.

Do you mean that you want to write a templated implementation once, and that implementation should call different function/methods/etc. depending on the templated type ?

Regards,
.Andrea