When are auto
and decltype
(for lack of a better word) "evaluated"? At runtime, or when the code is compiled?
If it is the former, does using them have any noticeable performance penalty compared to hard-coding the variable type?
Obviously at compile type; you can not have a variable with an unknown type at runtime. So using auto
should not incur any runtime performance penalty compared to hand-coded the corresponding type. (I mean exactly the same type as auto
would use. If you hand-code a different type, your performance obviously might change in whatever direction.)