From 477f3cb2f15116828861cd4b09c7d427622ae8b7 Mon Sep 17 00:00:00 2001 From: lightyear15 Date: Tue, 11 Apr 2023 21:40:48 +0200 Subject: [PATCH] in UR::UR constructor use std::move simply more efficient --- src/ur.cpp | 4 ++-- src/ur.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ur.cpp b/src/ur.cpp index 2227340..230d123 100644 --- a/src/ur.cpp +++ b/src/ur.cpp @@ -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(); diff --git a/src/ur.hpp b/src/ur.hpp index 6cf2fbf..6a40f40 100644 --- a/src/ur.hpp +++ b/src/ur.hpp @@ -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);