Skip to content

Commit 7c6f9f1

Browse files
authored
Use move ctor instead of copy ctor in stringOrDefault
1 parent 9065a0a commit 7c6f9f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libsolutil/Assertions.h

+2-1
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)