mirror of
https://github.com/oxen-io/oxen-storage-server.git
synced 2023-12-13 21:00:26 +01:00
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:
parent
8d34f76002
commit
d5876d9647
|
@ -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_; }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue