1

I am trying to fill a char array using another constexpr char array during compile time, but I do not see how could I do this.

I am trying to emulate the following:

constexpr char arr1[N] = {/* Permutation of the numbers 0..N-1 */}
char arr2[N];
for(int i=0;i<N;++i)
    arr2[arr1[i]]=i;

but since I cannot return an array from a function, I do not know how to do this. Furthermore, I would like arr2 to be constexpr, since everything I need to compute it is known at compile time.

Any ideas about how to do this?

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
Lezkus
  • 160
  • 1
  • 12

0 Answers0