So, this is not directly related to my question, not sure if should create a new one, but:
void test2()
{
map<char, int> myMap = {{'A',2}, {'B', 3}};
cout << myMap['A'] << endl;
map<float, vector<double>> data{{25.0, {14.0, 16.0, 18.0, 19.67, 21.33, 22.67}}};
data[25.0];
Double_t volts[] = {10, 20, 30, 40, 50, 60};
TCanvas* c1 = new TCanvas("c1", "test", 640, 480);
TGraph *graph1 = new TGraph(6, volts, data[25.0]);
graph1 -> Draw("ap");
}
Gives an error:
In file included from input_line_11:1:
/mnt/c/Users/acgc9/Desktop/test2.c:35:23: error: no matching constructor for initialization of 'TGraph'
TGraph *graph1 = new TGraph(6, volts, data[25.0]);
^ ~~~~~~~~~~~~~~~~~~~~
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:81:4: note: candidate constructor not viable: no known conversion from 'std::map<float, std::vector<double, std::allocator<double> >, std::less<float>, std::allocator<std::pair<const float, std::vector<double, std::allocator<double> > > > >::mapped_type' (aka 'std::vector<double, std::allocator<double> >') to 'const Double_t *' (aka 'const double *') for 3rd argument
TGraph(Int_t n, const Double_t *x, const Double_t *y);
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:79:4: note: candidate constructor not viable: no known conversion from 'Double_t [6]' to 'const Int_t *' (aka 'const int *') for 2nd argument
TGraph(Int_t n, const Int_t *x, const Int_t *y);
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:80:4: note: candidate constructor not viable: no known conversion from 'Double_t [6]' to 'const Float_t *' (aka 'const float *') for 2nd argument
TGraph(Int_t n, const Float_t *x, const Float_t *y);
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:88:4: note: candidate constructor not viable: no known conversion from 'int' to 'const char *' for 1st argument
TGraph(const char *filename, const char *format="%lg %lg", Option_t *option="");
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:84:4: note: candidate constructor not viable: requires 2 arguments, but 3 were provided
TGraph(const TVectorF &vx, const TVectorF &vy);
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:85:4: note: candidate constructor not viable: requires 2 arguments, but 3 were provided
TGraph(const TVectorD &vx, const TVectorD &vy);
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:87:4: note: candidate constructor not viable: requires at most 2 arguments, but 3 were provided
TGraph(const TF1 *f, Option_t *option="");
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:78:4: note: candidate constructor not viable: requires single argument 'n', but 3 arguments were provided
TGraph(Int_t n);
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:82:4: note: candidate constructor not viable: requires single argument 'gr', but 3 arguments were provided
TGraph(const TGraph &gr);
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:86:4: note: candidate constructor not viable: requires single argument 'h', but 3 arguments were provided
TGraph(const TH1 *h);
^
/mnt/d/Debian/ROOT/ROOT6.24.06/include/TGraph.h:77:4: note: candidate constructor not viable: requires 0 arguments, but 3 were provided
TGraph();
^
Probably this is due to my lack of knowledge about C++ vectors.