I am attempting to move away from std::vector<std::vector<int>> types and use boost::multi_array in its place. I am struggling how to initialize such data members though.
I used to have a class thus:
class problemdata{ std::vector<std::vector<int>> data; }; Then, at run time, based on values of user inputs ui1 and ui2, I would do the following to create storage for data.
std::vector<int> temp(ui2); for(int i = 0; i < ui1; i++) data.push_back(temp); How can I do something similar with boost::multi_array ? All examples in the official documentation seem to have compile time constants defining dimensions. https://www.boost.org/doc/libs/1_69_0/libs/multi_array/doc/user.html
I, however, need to declare an empty container first, read user data and only then accordingly populate the container.