开发者

What is the best way to store double dimension vector in c++?

开发者 https://www.devze.com 2022-12-15 05:38 出处:网络
What is the best w开发者_如何学运维ay to store double dimension vector in c++? std::vector <std::vector <int> > m_vector(N, std::vector<int>(M));

What is the best w开发者_如何学运维ay to store double dimension vector in c++?

std::vector <std::vector <int> > m_vector(N, std::vector<int>(M));
...
int k = m_vector[i][j];

How else?


The most efficient and most convenient at the same time is to use boost::multi_array.


As far as I know this is the BKM (Best known method). It's the most straight forward and it does what you need, with easy access using the [][] operator. You can always use set<> or list<> if you don't need vector's extra functionality...

0

精彩评论

暂无评论...
验证码 换一张
取 消