lundi 1 février 2016

How does decltype work?

Is it evaluated only on compile time? Does it look what is the expression type or it's return type and just substitutes it? I.e. does it work as macros preprocessor substitutions? Also if I wrote this:

std::map<std::string, int> m;
decltype(m.cbegin()) i;  // I cannot write decltype(m)::const_iterator i;

Is it going to call actually the cbegin and I will pay for some performance here?

Aucun commentaire:

Enregistrer un commentaire