Consider a large-scale software project that heavily utilizes templates and generic programming. With an impending deadline, the compilation time is becoming a significant bottleneck. Which C++ feature/technique might be best suited to reduce compilation times without altering runtime performance? 

  • Decrease template depth 
  • Explicit template instantiation 
  • Use dynamic polymorphism
  • Use of inline functions 
Explicit template instantiation can help reduce compilation times by instructing the compiler to instantiate the templates in a specific source file rather than whenever they're used. This can help reduce redundancy and speed up the compilation of large projects that heavily rely on templates.
Add your answer
Loading...

Leave a comment

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