I'm trying to create a QVector of multidimensional array(C++ array class) but I'm facing troubles with it
I have a class "node" and I want to pass the QVector of a multidimensional array as a parameter of the node class construct but this isn't working, I'm a getting a compile error!
Class node {
node(QVector<array<array<int, SIZE>, SIZE>> v);
}
any one has an idea of how should I proceed?
That will not compile without C++11 and on. You need two ways to address it:
Pre-C++11
C++11 and post
Correct, no change; it just works. Put this into your qmake project file:
However, since you seem to use "C++ array", you will need the latter solution. In other words, just add c++11 compilation support to you build.
You have further issues, too:
I am not sure where you got the idea of capital for the
Class
. It should be writtenclass
.Also, you inherently need the separator (
;
) after a class.You better do not use
array
in header files, butstd::array
.This is my working example:
main.cpp
main.pro
Build and Run