|
strange syntax |
Ariesnl
Member #2,902
November 2002
|
I was helping a collegue with tensor flow and I came across this syntax... I've never seen this in C++ InterpreterBuilder(*pModel, resolver)(&pInterpreter); where pModel is a pointer and strangely enough pInterpreter is a pointer too so in that case the address of a pointer is passed that would be a pointer pointer which makes no sense in this case.... anyone ? Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
Erin Maus
Member #7,537
July 2006
|
It looks like InterpreterBuilder is a class that overloads the function call operator: https://en.cppreference.com/w/cpp/language/operators So you're calling the constructor then calling the overload. Or it could be a function that returns an object that overloads the function call operator but that seems less likely. I've never used Tensorflow so I don't know for certain but those are two possible explanations for that syntax. --- |
Peter Hull
Member #1,136
March 2001
|
It's this: The code is doing something like std::unique_ptr<Interpreter>* pInterpreter= ...; FlatBuffer* pModel = ...; OpResolver resolver = ...; InterpreterBuilder builder(*pModel, resolver); // construct TfLiteStatus status = builder(&pInterpreter); // call operator() and the last line is really TfLiteStatus status = builder.operator()(&pInterpreter);
|
|