Skip to content

Commit e38c515

Browse files
committed
in UR::UR constructor use std::move
simply more efficient
1 parent 07e5f99 commit e38c515

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/ur.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ using namespace std;
1313

1414
namespace ur {
1515

16-
UR::UR(const std::string &type, const ByteVector &cbor)
17-
: type_(type), cbor_(cbor)
16+
UR::UR(std::string type, ByteVector cbor)
17+
: type_(std::move(type)), cbor_(std::move(cbor))
1818
{
1919
if (!is_ur_type(type)) {
2020
throw invalid_type();

src/ur.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class UR {
2424
const std::string& type() const { return type_; }
2525
const ByteVector& cbor() const { return cbor_; }
2626

27-
UR(const std::string& type, const ByteVector& cbor);
27+
UR(std::string type, ByteVector cbor);
2828
};
2929

3030
bool operator==(const UR& lhs, const UR& rhs);

0 commit comments

Comments
 (0)