Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-9037

TDataFrame ctor does not compile if std::string is passed as filename

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 6.10/06, master
    • Fix Version/s: 6.12/00, 6.10/08
    • Component/s: Other
    • Labels:
      None
    • Environment:

      any

      Description

      std::string fname("f.root");
      TDataFrame d("t", fname);

      does not compile. Other constructs such as d("t","f.root") or d("t", {"f.root","f2.root"}) work as expected.

      Reproducer, e.g. from the prompt:

      cern762:~$ root -l
       root [0] std::string f("ad")
       (std::string &) "ad"
       root [1] ROOT::Experimental::TDataFrame d("t", f)
       In file included from input_line_11:21:
       In file included from /home/eguiraud/ROOT/root_v610_build/etc/dictpch/allHeaders.h:1139:
       /home/eguiraud/ROOT/root_v610_build/include/ROOT/TDataFrame.hxx:68:52: error: no matching function for call to 'ToConstCharPtr'
       for (auto &fileName : filenamescoll) chain->Add(TDFInternal::ToConstCharPtr(fileName));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
       ROOT_prompt_1:1:32: note: in instantiation of function template specialization 'ROOT::Experimental::TDataFrame::TDataFrame<std::__cxx11::basic_string<char>, 0>' requested here
       ROOT::Experimental::TDataFrame d("t", f)
       ^
       /home/eguiraud/ROOT/root_v610_build/include/ROOT/TDFUtils.hxx:190:13: note: candidate function not viable: no known conversion from 'const char' to 'const char *' for 1st argument; take the address of the argument with &
       const char *ToConstCharPtr(const char *s);
       ^
       /home/eguiraud/ROOT/root_v610_build/include/ROOT/TDFUtils.hxx:191:13: note: candidate function not viable: no known conversion from 'const char' to 'const std::string' (aka 'const basic_string<char>') for 1st argument
       const char *ToConstCharPtr(const std::string s);
       ^
       root [2]
       
       

        Attachments

          Activity

            People

            Assignee:
            eguiraud Enrico Guiraud
            Reporter:
            eguiraud Enrico Guiraud
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Actual End: