lundi 8 août 2016

Copy constexpr array into class

Suppose I have a class:

class MyClass{
  char array[12];
  public:
  MyClass(const char* arr) {
    for (int x = 0; x < 12; x++){
      array[x] = arr[x];
    }
  }
};

Is it possible to make the MyClass constructor constexpr. The tricky part is initializing the new array....

Aucun commentaire:

Enregistrer un commentaire