1

When we make a call to a template function in c++,i don't understand what special work does the compiler does that at that time due to which it is able to recognize the class with which we have called that template class and then it resolves itself accordingly.

asad_hussain
  • 1,959
  • 1
  • 17
  • 27
  • 4
    Compilers make lots of decisions during a call resolution. It is unclear which one(s) you don't understand. Perhaps a specific example is in order. Show a call and all relevant declarations. – n. m. could be an AI May 23 '16 at 05:07
  • Far too broad. You are asking how a major section of the specification is implemented. Take a course or read a book. – user207421 May 23 '16 at 05:13

1 Answers1

2

The answer may depend on the compiler type. For example, in gcc/clang there is something called two-phase lookup. But this feature is not implemented in Visual Studio. This other post on SO gives a good explanation:

Two phase lookup - explanation needed

Also take a look at this post:

c++ complier behaviour using template class

Community
  • 1
  • 1
polfosol ఠ_ఠ
  • 1,840
  • 26
  • 41