0

We know that compiler will decay array/function to pointers when needed(according to context), then when is the time we should explicitly use std::decay?

Is there any task that requires us to use it, or else, compiler doesn't know how to handle it?

Thanks.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Hind Forsum
  • 9,717
  • 13
  • 63
  • 119

1 Answers1

0

Simply put, decay::type is the identity type-transformation except if T is an array type or a reference to a function type. In those cases the decay::type yields a pointer or a pointer to a function, respectively.

For more detail please see this https://stackoverflow.com/a/25732651/1691223

Community
  • 1
  • 1
Shravan40
  • 8,922
  • 6
  • 28
  • 48