Simplification

No need to bifurcate rvalue and const-lvalue versions here: a plain
value will work exactly the same (copying or moving based on what the
caller provides).
This commit is contained in:
Jason Rhinelander 2021-04-13 01:40:00 -03:00
parent 8d34f76002
commit d5876d9647

View file

@ -32,12 +32,10 @@ class user_pubkey_t {
user_pubkey_t() {}
user_pubkey_t(std::string&& pk) : pubkey_(std::move(pk)) {}
user_pubkey_t(const std::string& pk) : pubkey_(pk) {}
user_pubkey_t(std::string pk) : pubkey_(std::move(pk)) {}
public:
static user_pubkey_t create(std::string&& pk, bool& success) {
static user_pubkey_t create(std::string pk, bool& success) {
success = true;
if (pk.size() != get_user_pubkey_size()) {
success = false;
@ -46,15 +44,6 @@ class user_pubkey_t {
return user_pubkey_t(std::move(pk));
}
static user_pubkey_t create(const std::string& pk, bool& success) {
success = true;
if (pk.size() != get_user_pubkey_size()) {
success = false;
return {};
}
return user_pubkey_t(pk);
}
const std::string& str() const { return pubkey_; }
};