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

TF1. Problem with the internal template function GetTheRightOp with std::bind

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: 6.12/00, 6.13/01, 6.14/00, 6.15/01, 6.18/00
    • Fix Version/s: None
    • Component/s: Graphics
    • Labels:
      None
    • Environment:

      ROOT Version: 6.10, 6.18
      Platform: CC7
      Compiler: gcc 4.8.5

    • Development:

      Description

      Dear rooters,

      It seems that TF1 does not admit a "std::bind" as argument since v6.10. The following code works in 6.10, but not in newer versions,

       

       

      originalFF = [](double *x , double *par){ (void)par; return *x; }; // original function; it can be a functor, a proper function, a lambda... 
      boundFF = std::bind (originalFF,std::placeholders::_1, std::placeholders::_2); 
      TF1 myFitFunct("myFitFunct", boundFF,0, 1 , 0 )
      

       

       

      It seems TF1 still admits lambda functions as arguments; this example works also in newer versions

      originalFF = [](double *x , double *par){ (void)par; return *x; };
      boundFF = std::bind (originalFF,std::placeholders::_1, std::placeholders::_2); 
      intermediateFF = [](double *x , double *par){ return boundFF(x, par); } // extra step in order to use std::bind with TF1
      TF1 myFitFunct("myFitFunct", intermediateFF,0, 1 , 0 )
      

       

      OP: https://root-forum.cern.ch/t/std-bind-wrapped-by-tf1-is-not-supported-since-6-10/35466

      Thank you for your time.

      Regards,

      atd

        Attachments

          Activity

            People

            • Assignee:
              moneta Lorenzo Moneta
              Reporter:
              atolosad Alvaro Tolosa Delgado
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: