0

For example.

float test[2];
map < string, "what should I put here?" > myMap;

I want a map where keys are string, and values are array of float in size 2. I can use vector <float>, but I don't want to use vectors.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by jonsca
1

I believe (I had to try a little example) that it's float*

float a[2] = {4.0,5.7};
	float b[2] = {1.3,9.8};
	string label1 = "label1";
	string label2 = "label2";

	map<string, float *> mymap;

	mymap[label1] = a;
	mymap[label2] = b;
	cout <<mymap[label1][1]<<endl;

output is 5.7

Votes + Comments
Simple, clear and fast answer. Thanks :)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.