Vectors and TGraphErrors

Dear experts,

I would like to draw a graph with TgraphErrors, Sometimes its more convenient to work with vectors, however TGraphErrors require a Double_t.


void test() {
  vector<Double_t> x,y, err_x,err_y;
      //some push_back procedure here to fill in the vector

  TGraphErrors *ge = new TGraphErrors(x.size(), &(x[0]), &(y[0]), 0., &(err_y[0]) );

Root complains

Error: Can't call TGraphErrors::    . . . . Possible candidates are...
(in TGraphErrors)

Is there a way to elegantly deal with this?

#include "TGraphErrors.h" // note ".h" // ... TGraphErrors *ge = new TGraphErrors(x.size(), &(x[0]), &(y[0]), 0, &(err_y[0]) ); // note "0,", NOT "0.,"