the parameter 'szModelPath' is copied for each invocation but only used as a const reference; consider making it a const reference
233 * @author clayjay3 ([email protected])
234 * @date 2023-11-11
235 ******************************************************************************/
236 TPUInterpreter(std::string szModelPath, PerformanceModes ePowerMode = eHigh, unsigned int unMaxBulkInQueueLength = 32, bool bUSBAlwaysDFU = false) :237 TensorflowTPU<std::vector<std::vector<Detection>>, cv::Mat>(szModelPath, ePowerMode, unMaxBulkInQueueLength, bUSBAlwaysDFU)
238
239 {}
Description
A parameter is declared to be call-by-value when a const reference will suffice. This parameter type is expensive to copy.
The check is only applied to parameters of types that are expensive to copy which means they are not trivially copyable or have a non-trivial copy constructor or destructor.
Consider using a const reference to the value instead.
Bad practice
void f(const string Value) {
// consider making Value a reference.
}
void g(ExpensiveToCopy Value) {
// consider making Value a const reference.
Value.ConstMethd();
ExpensiveToCopy Copy(Value);
}
Recommended
void f(const string& Value) {
// ...
}
void g(const ExpensiveToCopy& Value) {
// ...
Value.ConstMethd();
ExpensiveToCopy Copy(Value);
}