Skip to content

Commit

Permalink
in UR::UR constructor use std::move
Browse files Browse the repository at this point in the history
simply more efficient
  • Loading branch information
lightyear15 committed Apr 12, 2023
1 parent 1b2078e commit 477f3cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ using namespace std;

namespace ur {

UR::UR(const std::string &type, const ByteVector &cbor)
: type_(type), cbor_(cbor)
UR::UR(std::string type, ByteVector cbor)
: type_(std::move(type)), cbor_(std::move(cbor))
{
if (!is_ur_type(type)) {
throw invalid_type();
Expand Down
2 changes: 1 addition & 1 deletion src/ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class UR {
const std::string& type() const { return type_; }
const ByteVector& cbor() const { return cbor_; }

UR(const std::string& type, const ByteVector& cbor);
UR(std::string type, ByteVector cbor);
};

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

0 comments on commit 477f3cb

Please sign in to comment.