vendredi 27 février 2015

C++ - How to Make Static Dictionary to Lookup Matrix

I am trying to write a C++ class that allows me to access certain matrix elements by a string lookup. I wanted to create a 'static' class that can do this, such as:



#include <unordered_map>
namespace Mine {
static double AA[3][4] = {
{5.04964676394959,-0.693207030363152,0.0422140829479668,-0.000968959310672217},
{2.6044054979329,0.288475262243944,-0.0208805589126506,0.000380899394040856},
{-4.32707864788065,1.07090008760872,-0.0777874445746693,0.00165150952598117}
};
static unordered_map<std::string, double[3][4]> Mine::parameter_store = { {"AA", AA}};


With the idea being that I would have several matrices, and could look them up based on a key. However, this seems to totally and utterly fail with the following error:



error: object expression of non-scalar type 'double [3][4]' cannot be used in a pseudo-destructor expression


Is it possible to build a lookup table this way in C++?


Aucun commentaire:

Enregistrer un commentaire