Why is the data type std::array differently here.
using T = const int *; std::array<T, 4> x = { &a, &b, &c, &d };
compared to this?
using T = int *; std::array<const T, 4> x = { &a, &b, &c, &d };
This second case is equivalent to const std::array<T, 4> (a constant pointer to mutable data). If we directly use const int * : std::array<const int*, 4> , we get the behavior of the first case.
More precisely, why using T = int*; std::array<const T, 4>; using T = int*; std::array<const T, 4>; equivalent to std::array<int*const, 4> , and not std::array<const int*, 4> ?
c ++ arrays pointers const type-deduction
Judge
source share