I'm really surprised that the first example doesn't work. I would have thought that it decides which overload to use only when instantiating the template, and then doing argument dependent lookup (or whatever it is called) to pick the correct overload to match the type of the elements.
On the other hand, I don't even know how transform is defined. C++ has nothing exactly like IEnumerable<T>, so maybe it is hard to refer to the T? And of course what the article references, that there is no way to refer to the overload set.
I usually like C++, but it is not fun when the abstractions break like that.
The compiler doesn't have enough information yet to pick an overload when instantiating the transform template. transform takes any F as the function parameter, which isn't specific enough to pick a specific function pointer from an overload set.
On the other hand, I don't even know how transform is defined. C++ has nothing exactly like IEnumerable<T>, so maybe it is hard to refer to the T? And of course what the article references, that there is no way to refer to the overload set.
I usually like C++, but it is not fun when the abstractions break like that.