What is the best way to create a sparse array in C++?
For C++, a map works well. Several million objects won’t be a problem. 10 million items took about 4.4 seconds and about 57 meg on my computer. My test application is as follows: #include <stdio.h> #include <stdlib.h> #include <map> class triple { public: int x; int y; int z; bool operator<(const triple &other) const { … Read more