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
  • 413,367
  • 61
  • 711
  • 904
Hind Forsum
  • 8,897
  • 9
  • 50
  • 103

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
  • 7,746
  • 5
  • 27
  • 45