Comparison with Runtime Polymorphism
Learn how to use runtime polymorphism through an example of a generic modulus function using if constexpr.
We'll cover the following...
We'll cover the following...
Runtime polymorphism
As a side note, if we were to implement the with traditional runtime polymorphism, using inheritance and virtual functions to achieve the same functionality, the implementation would look as follows:
The objects have to be accessed using pointers or references, and the type is inferred at runtime, which results in a performance loss compared with the compile-time version, ...