0

Now I know why it wouldnt work if the difference was the return type, but I really dont get why the below functions would be ambiguos:

template<typename... Args>
static void addTo(const Entity &en, Args...args){
//something
}
and
    template<typename... Args>
void addTo(const Entity &en, Args...args)

Now please do explain the way this works in the background, since I dont seem to know enough about how this stuff works. In my mind it should work since:

Both functions are called differently (different operators, one runs off the classname itself and one off an instance)

~~My Guess~~

Now this is just a guess but it seems to be the only logical explanation, so bear with me. So as far as I know every member function is expanded to the fully qualified name (i hope thats what its called). So both functions are expanded to Class::addTo, which leads to the compiler not being able to tell them apart.

~~What Gives?~~

I really have no idea why this shouldnt work. Both on the design aspect (why shouldnt this work) and on a technical aspect (except my guess above).

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
MoustacheSpy
  • 743
  • 1
  • 6
  • 27

0 Answers0