Skip to content

Commit aa531e5

Browse files
authored
Update hashpp.h
1 parent f06e034 commit aa531e5

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

include/hashpp.h

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,9 @@ namespace hashpp {
19461946
// hash returned by the above described function(s)
19471947
class hash {
19481948
public:
1949-
hash() = default;
1949+
hash() noexcept = default;
1950+
hash(const hash& hashObj) noexcept : hashStr(hashObj.hashStr) {}
1951+
hash(hash&& hashObj) noexcept : hashStr(std::move(hashObj.hashStr)) {}
19501952
hash(const std::string& hex) noexcept : hashStr(hex) {}
19511953
hash(std::string&& hex) noexcept : hashStr(std::move(hex)) {}
19521954

@@ -1959,13 +1961,22 @@ namespace hashpp {
19591961
return _Ostr;
19601962
}
19611963

1962-
bool operator==(const hashpp::hash& _rhs) {
1964+
hash& operator=(const hashpp::hash& _rhs) noexcept {
1965+
this->hashStr = _rhs.hashStr;
1966+
return *this;
1967+
}
1968+
1969+
hash& operator=(hashpp::hash&& _rhs) noexcept {
1970+
this->hashStr = std::move(_rhs.hashStr);
1971+
return *this;
1972+
}
1973+
1974+
bool operator==(const hashpp::hash& _rhs) noexcept {
19631975
return _rhs.hashStr == this->hashStr;
19641976
}
1965-
1966-
template <class _Ty,
1967-
std::enable_if_t<std::is_constructible_v<std::string, _Ty>, int> = 0>
1968-
bool operator==(const _Ty& _rhs) {
1977+
1978+
template <class _Ty, std::enable_if_t<std::is_constructible_v<std::string, _Ty>, int> = 0>
1979+
bool operator==(const _Ty& _rhs) noexcept {
19691980
return _rhs == this->hashStr;
19701981
}
19711982

@@ -1993,9 +2004,12 @@ namespace hashpp {
19932004

19942005
class hashCollection {
19952006
public:
2007+
hashCollection() noexcept = default;
2008+
hashCollection(const hashCollection& hc) noexcept : collection(hc.collection) {}
2009+
hashCollection(hashCollection&& hc) noexcept : collection(std::move(hc.collection)) {}
19962010
hashCollection(const std::vector<std::pair<std::string, std::vector<std::string>>>& data) noexcept : collection(data) {}
19972011
hashCollection(std::vector<std::pair<std::string, std::vector<std::string>>>&& data) noexcept : collection(std::move(data)) {}
1998-
2012+
19992013
// operator[] overload to access collections of hashpp
20002014
// by their specific algorithm
20012015
std::vector<std::string> operator[](const std::string& algoID) const {

0 commit comments

Comments
 (0)