Open pgbovine opened 5 years ago
a possibly-related example in C++ class (instead of struct) definition:
template<typename T>
class Node{
private:
T data;
Node<T>* children[]; // problem here! works if [] -> [10] (or any number) or "Node<T>** children;"
public:
Node(T data, char size) {
data = data;
for (char i = 0; i < size; i++) children[i] = 0;
}
};
int main() {
Node<int> node = Node<int>(5, 10);
return 0;
}
Maybe relevant or maybe not? https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html
(NB: is this just because i'm using C11 and not a newer dialect?)
examples: