Anna
Anna

Reputation: 2845

How to store a 3D array of floats in C++?

How should I store a 3D array of floats in C++? I only have 100x100x100 elements, so efficient storage isn't important.

In C I would have used float arr[100][100][], but I suppose there is a more modern approach in C++. Since std::array has such a long type (std::array<std::array<std::array<float>>>), I feel like there is a better way.

What is the recommended solution?

Upvotes: 3

Views: 502

Answers (1)

Lukasz
Lukasz

Reputation: 196

Try multi_array from boost. It does what you need.

http://www.boost.org/doc/libs/1_55_0/libs/multi_array/doc/user.html

Upvotes: 2

Related Questions