Begin(), end() not working with ROOT v6.xy

I want to have a bunch of histograms copied from array to a vector.

Here’s the simple code

TH1D *h1, *h2; TH1D *hArr[] = {h1, h2} int arr[] = {3, 2}; vector<TH1D*> vh(begin(&hArr), end(&hArr)); cout << vh.size() << endl; // fails. vector<int>vdarr(begin(arr), end(arr)); //fails


this example will get you started. It shows that the proper addresses are preserved. It is enough to copy and paste it into the root prompt.

auto h1 = new TH1D();
auto h2 = new TH1D();
TH1D *hArr[] = {h1, h2}
int arr[] = {3, 2};
vector<TH1D*> vh(begin(hArr), end(hArr));
cout << vh.size() << endl;          
for (auto h : vh) cout << h << endl;
cout << h1 << endl;
cout << h2 << endl;
vector<int>vdarr(begin(arr), end(arr));        
for (auto i : vdarr) cout << i << endl;