mardi 21 février 2017

If C++ decides "decay" array/function for it self, why C++11 introduce a "decay" functor?

In C++, the "decay" of array->pointer and function->function pointer happens when we pass array/function name as parameter to function call argument. This is automatically done by compiler itself.

My question is why in C++11 the new language standard should introduce a template "decay" functor? I don't see obvious real-world usage of it, and the website(http://ift.tt/1mdX28a) simply gives an snippet that this "decay" could help to detect if some types could be decay-ed into some other types, which I suppose not useful at all.

Would you kindly give some example?

Aucun commentaire:

Enregistrer un commentaire