当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - Size of a 3D array/unordered_map

问题描述:

I'm reading a very large file into a 3D std::unordered_map, however I need to know the size of each dimension. But I can't figure out how to do that. Here's the code:

void Window::openButton2Clicked()

{

ifstream file("Told.dat");

std::unordered_map<unsigned, std::unordered_map<unsigned, std::unordered_map<unsigned, double>>> Told;

if(file.is_open())

{

while(file.good()){

string line;

while(getline(file, line)){

istringstream iss{line};

unsigned i, j, k;

double value, garbage;

if(iss >> i >> j >> k >> garbage >> garbage >> garbage >> value >> garbage >> garbage)

{

Told[i][j][k] = value;

}

else

status2->setText("<font color='red'>File failed to load</font>");

}

}

}

else

status2->setText("<font color='red'>File failed to load</font>");

status2->setText("<font color='green'>File loaded</font>");

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: