Skip to content

Commit a4b12ef

Browse files
authored
Updated raw loop to std::copy_if. (#1925)
1 parent 699f7b0 commit a4b12ef

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Packet++/src/SmtpLayer.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,8 @@ namespace pcpp
158158
}
159159

160160
std::string optionWithEscapeChars;
161-
for (char ch : option)
162-
{
163-
if (ch < 127 && ch > 31)
164-
{
165-
optionWithEscapeChars.push_back(ch);
166-
}
167-
}
161+
std::copy_if(option.begin(), option.end(), std::back_inserter(optionWithEscapeChars),
162+
[](char ch) { return ch < 127 && ch > 31; });
168163

169164
return optionWithEscapeChars;
170165
}

0 commit comments

Comments
 (0)