float
to double
in a math function CXX-P2001Calling math functions that only accept double
with float
arguments
causes an implicit type promotion of float
argument.
Type promoting float
to double
costs extra space in memory, it also costs extra
instructions for the conversion from float
and lastly vectorisation of float
is a lot more efficient compared to double
.
std::string
CXX-P2003Found using sub-string based method find
for a character look-up.
Copying an object is an expensive operation, especially if the type of the object is not trivial to copy. To avoid creating an unnecessary copy of such object, use const references.
The analyser has found a local variable that can't be automatically moved. The reason for this behavior is the constness of the variable. Consider declaring the variable without the qualifier const
.
std::vector
in loop CXX-P2007Manually appending a significant number of elements to a std::vector
without reserving the memory upfront can cause performance issues as the memory needs to be reallocated and copied every time the std::vector
's size increases. This can be costly if many items need to be pushed into the std::vector
. Consider using the std::vector::reserve()
function to preallocate memory for the std::vector
before a loop containing a std::vector::push_back
.