I am running into error where in declaration of VLA is giving error of "expression did not evaluate to a constant" - I tried to declare int l,m,r,n1,n2 constant but still it doesn't work. While I am aware of concept that compiler would like to know fixed size array at compile time, however I have seen few implementation online where folks have implemented as below.
Additional wiki search enter link description here have shown not all version of C++ support it -
Question - how to make it work without creating dynamic memory allocation ?
template<typename T>
void mergesort<T>::_merge_array(int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
/* create temp arrays */
int L[n1], R[n2]; // error -
}