> How to make alias for variable of a one and/or two dimensional array
Do it in a series of simple steps. For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int main()
{
using arr_t = int[23] ; // type alias for array of 23 int
typedefint arr_t[23] ; // same as above, it is just a redeclaration
using ref_t = arr_t& ; // type alias for reference to array of 23 int
arr_t a1 {} ; // same as int a1[23]{} ;
ref_t r = a1 ; // initialise the reference to refer to a1
auto& r1 = a1 ; // simpler: use type deduction
using arr2d_t = arr_t[5] ; // type alias for array of 5 arr_t ie. 2d array int[5][23]
using ref2d_t = arr2d_t& ; // type alias for reference to 2d array int[5][23]
arr2d_t a2d {} ; // same as int a1[5][23]{} ;
ref2d_t r2d = a2d ; // initialise the reference to refer to a2d
auto& r2d1 = a2d ; // simpler: use type deduction
}