I have the following class
template<int ... Args>
struct foo {
constexpr static int arr[sizeof...(Args)]={Args...};
constexpr int dimension(int i) {return arr[i];}
};
But I get undefined reference to arr, while calling dimension. If I move arr inside the function dimension then the function cannot be a constexpr anymore, because it requires two semicolons within the body of the function. For instance, I cannot do
constexpr int a = foo_obj.dimension(2);
My goal is to metaprogrammatically iterate over all the dimensions of a varidic template and compare it to another integral number? Ideally if I have two objects of foo I want to determine if they are equal in every dimension.
Aucun commentaire:
Enregistrer un commentaire