template<typename T, unsigned int n>
struct ArrayWrapper
{
T v[n];
T& operator[](unsigned int i) { return v[i]; } // You can also check for out-of-bounds errors
const T& operator[](unsigned int i) const { return v[i]; } // You can also check for out-of-bounds errors
};
#include <map>
#include <iostream>
int main()
{
typedef std::map<size_t, ArrayWrapper<double,2> > Map;
Map trace;
trace[1][0] = 42;
for(Map::const_iterator it = trace.begin(); it != trace.end(); ++it)
std::cout << "( " << (*it).first
<< ", " << (*it).second[0]
<< ", " << (*it).second[1]
<< ")\n";
}
CnRlbXBsYXRlPHR5cGVuYW1lIFQsIHVuc2lnbmVkIGludCBuPgpzdHJ1Y3QgQXJyYXlXcmFwcGVyCnsKICAgIFQgdltuXTsKICAgIFQmIG9wZXJhdG9yW10odW5zaWduZWQgaW50IGkpIHsgcmV0dXJuIHZbaV07IH0gLy8gWW91IGNhbiBhbHNvIGNoZWNrIGZvciBvdXQtb2YtYm91bmRzIGVycm9ycwogICAgY29uc3QgVCYgb3BlcmF0b3JbXSh1bnNpZ25lZCBpbnQgaSkgY29uc3QgeyByZXR1cm4gdltpXTsgfSAvLyBZb3UgY2FuIGFsc28gY2hlY2sgZm9yIG91dC1vZi1ib3VuZHMgZXJyb3JzCn07CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxpb3N0cmVhbT4KaW50IG1haW4oKQp7CiAgICB0eXBlZGVmIHN0ZDo6bWFwPHNpemVfdCwgQXJyYXlXcmFwcGVyPGRvdWJsZSwyPiA+IE1hcDsKICAgIE1hcCB0cmFjZTsKICAgIHRyYWNlWzFdWzBdID0gNDI7CiAgICBmb3IoTWFwOjpjb25zdF9pdGVyYXRvciBpdCA9IHRyYWNlLmJlZ2luKCk7IGl0ICE9IHRyYWNlLmVuZCgpOyArK2l0KQogICAgICAgIHN0ZDo6Y291dCA8PCAiKCAiIDw8ICgqaXQpLmZpcnN0CiAgICAgICAgICAgIDw8ICIsICIgPDwgKCppdCkuc2Vjb25kWzBdCiAgICAgICAgICAgIDw8ICIsICIgPDwgKCppdCkuc2Vjb25kWzFdCiAgICAgICAgICAgIDw8ICIpXG4iOwp9