How does C++ handle template instantiation when the same instantiation is required in multiple translation units? 

  • Via separate instantiation 
  • Via shared instantiation 
  • Via static instantiation 
  • Via dynamic instantiation
C++ typically handles template instantiation on a per-translation unit basis. This means each translation unit will have its own instance of the template. Linkers are smart enough to discard duplicate instances, ensuring that only one instance remains in the final executable.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *