how does templates work, are they always inlined?

后端 未结 6 1627
谎友^
谎友^ 2020-12-20 19:59

I can understand how it work if they are inlined. But if they are not, how does it work? does all object files get their own copy of for example the function template anyway

6条回答
  •  孤城傲影
    2020-12-20 20:36

    Templates are really very very advanced MACROS (#define)

    parameters are replaced at compile time with the passed values. Really great concept and also implemented very wel.

提交回复
热议问题