The solution became very similar to what I showed in the question. Though with some small modifications:
std::ifstream file("file.txt");
std::vector<std::vector<std::vector<std::string>>> data;
data.push_back(std::vector<std::vector<std::string>>());
std::string line;
while(std::getline(file, line)){
std::stringstream stream(line);
if (line.size() > 1){
data.back().push_back(std::vector<std::string>());
std::string val;
while(stream >> val){
data.back().back().push_back(val);
}
}
else {
array_.push_back(std::vector<std::vector<Entity>>());
}
}
To print the result:
for (auto v1 : data){
for (auto v2 : v1){
for(auto s : v2){
std::cout << s << " ";
}
std::cout << std::endl;
}
std::cout << std::endl;
}
Gives:
d d d d d
d d d d d
d d d d d
d d d d d
d d d d d
s s s s s
... etc