Skip to content

Commit 0ea874c

Browse files
committed
PERF: readability container size empty
The emptiness of a container should be checked using the empty() method instead of the size() method. It is not guaranteed that size() is a constant-time function, and it is generally more efficient and also shows clearer intent to use empty(). Furthermore some containers may implement the empty() method but not implement the size() method. Using empty() whenever possible makes it easier to switch to another container in the future. SRCDIR= #My local SRC BLDDIR= #My local BLD cd run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,readability-container-size-empty -header-filter=.* -fix
1 parent 3b40d22 commit 0ea874c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/itkSpeedFunctionToPathFilter.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ SpeedFunctionToPathFilter<TInputImage, TOutputPath>::GenerateData()
172172
}
173173

174174
// Ensure the user has added at least one path info object
175-
if (m_Information.size() == 0)
175+
if (m_Information.empty())
176176
{
177177
itkExceptionMacro("No PathInfo objects: at least one must be added.");
178178
}

0 commit comments

Comments
 (0)