Skip to content

Commit 0dce029

Browse files
authored
Merge pull request ethereum#14936 from PragmaTwice/add-move-to-string-or-default
Use move ctor instead of copy ctor in stringOrDefault
2 parents ab55b0a + 7c6f9f1 commit 0dce029

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libsolutil/Assertions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <libsolutil/Exceptions.h>
2929

3030
#include <string>
31+
#include <utility>
3132

3233
namespace solidity::util
3334
{
@@ -69,7 +70,7 @@ inline std::string stringOrDefault(std::string _string, std::string _defaultStri
6970
{
7071
// NOTE: Putting this in a function rather than directly in a macro prevents the string from
7172
// being evaluated multiple times if it's not just a literal.
72-
return (!_string.empty() ? _string : _defaultString);
73+
return (!_string.empty() ? std::move(_string) : std::move(_defaultString));
7374
}
7475

7576
}

0 commit comments

Comments
 (0)