resource: make return type explicit for operator=

This commit is contained in:
Michele Caini
2024-05-24 09:22:02 +02:00
parent 09da09500a
commit 8433060092

View File

@@ -98,9 +98,8 @@ public:
* @param other The handle to copy from.
* @return This resource handle.
*/
template<typename Other>
std::enable_if_t<is_acceptable_v<Other>, resource &>
operator=(const resource<Other> &other) noexcept {
template<typename Other, typename = std::enable_if_t<is_acceptable_v<Other>>>
resource &operator=(const resource<Other> &other) noexcept {
value = other.value;
return *this;
}
@@ -111,9 +110,8 @@ public:
* @param other The handle to move from.
* @return This resource handle.
*/
template<typename Other>
std::enable_if_t<is_acceptable_v<Other>, resource &>
operator=(resource<Other> &&other) noexcept {
template<typename Other, typename = std::enable_if_t<is_acceptable_v<Other>>>
resource &operator=(resource<Other> &&other) noexcept {
value = std::move(other.value);
return *this;
}