root icon indicating copy to clipboard operation
root copied to clipboard

Code generated by TFile::MakeProject should not rely on std namespace import

Open jblomer opened this issue 4 years ago • 3 comments

Explain what you would like to see improved

As discussed in the ROOT forum: the code generated by TFile::MakeProject currently contains the following lines at the beginning

namespace std {} using namespace std;

which is necessary because the header files to not qualify std names (e.g., vector instead of std::vector).

@Wile.E.Coyote provided the following comment in the forum:

Actually, it seems to me that the origin of the problem is that the “std::” was removed at the TTree creation time (i.e. if you try “tree->Print();”, you will see that it is not there). It seems to me that this is a long-standing problem which should be fixed (i.e. “std::” should be preserved).

Optional: share how it could be improved

It would be nicer if header files did qualify names from the std namespace so that they can be easier included in other projects.

To Reproduce

Use TFile::MakeProject on a ROOT file with a non-trivial tree.

Setup

  1. Master
  2. Arch Linux
  3. Built from sources

jblomer avatar Sep 22 '20 15:09 jblomer

Changing the onfile normalized name might not be forward compatible (old version of ROOT not being able to read new files).

pcanal avatar Sep 22 '20 15:09 pcanal

Can this be closed as won't fix given the comment of @pcanal ?

dpiparo avatar Feb 02 '24 08:02 dpiparo

I am closing the issue. Please feel free to reopen if you have an answer to the question asked above.

dpiparo avatar Apr 24 '24 12:04 dpiparo