Is Template Metaprogramming faster than the equivalent C code?

前端 未结 8 2368
旧时难觅i
旧时难觅i 2021-01-02 02:07

Is Template Metaprogramming faster than the equivalent C code ? ( I\'m talking about the runtime performance) :)

8条回答
  •  说谎
    说谎 (楼主)
    2021-01-02 02:34

    Template metaprogramming can be thought of as compile-time execution.

    The compile-time is going to take longer to compile your code since it has to compile and then execute the templates, generate code, then compile again.

    The run-time overhead I am not sure about, it shouldn't be much more than if you wrote it yourself in C code I would imagine.

提交回复
热议问题