I am trying to understand this usage of std::bind usage.
For this example std::bind(&TrtNodeValidator::IsTensorRTCandidate, &validator, std::placeholders::_1) They are trying to bind the function TrtNodeValidator::IsTensorRTCandidate. However, according to the definition of this API, Status TrtNodeValidator::IsTensorRTCandidate(const Node* node); it only accepts one parameter. Why they still need &validator when there exits std::placeholders::_1?
>Solution :
TrtNodeValidator::IsTensorRTCandidate is a non-static member function.
Aside from its explicit parameters, it requires a TrtNodeValidator* to become this.
std::bind(&TrtNodeValidator::IsTensorRTCandidate, &validator,
std::placeholders::_1)
will produce a callable object that calls
(&validator)->IsTensorRTCandidate(std::placeholders::_1)