Skip to content

Commit 9e872db

Browse files
committed
Add ALTERNATIVE_VARIANT_ASSIGNMENT.
1 parent a19ee5b commit 9e872db

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

include/bitcoin/system/types.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,16 @@ constexpr type& operator=(Alternative&& alternative) NOEXCEPT \
294294
{ \
295295
inner.template emplace<Alternative>(std::forward<Alternative>(alternative)); \
296296
return *this; \
297-
}
297+
}
298+
299+
/// Generate operator= overloads forwarding assignment for a specific alt type.
300+
#define ALTERNATIVE_VARIANT_ASSIGNMENT(type, Alternative, inner) \
301+
FORWARD_ALTERNATIVE_VARIANT_ASSIGNMENT(type, Alternative, inner) \
302+
constexpr type& operator=(const Alternative& alternative) NOEXCEPT \
303+
{ \
304+
inner = alternative; \
305+
return *this; \
306+
}
298307

299308
/// Argument placeholders.
300309
/// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)