mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Added unpack macro for Triple (#2277)
This commit is contained in:
@@ -12,7 +12,6 @@ struct Pair
|
||||
@require $assignable(self.first, $typeof(*a)) : "You cannot assign the first value to a"
|
||||
@require $assignable(self.second, $typeof(*b)) : "You cannot assign the second value to b"
|
||||
*>
|
||||
|
||||
macro void Pair.unpack(&self, a, b)
|
||||
{
|
||||
*a = self.first;
|
||||
@@ -28,6 +27,21 @@ struct Triple
|
||||
Type3 third;
|
||||
}
|
||||
|
||||
<*
|
||||
@param [&out] a
|
||||
@param [&out] b
|
||||
@param [&out] c
|
||||
@require $assignable(self.first, $typeof(*a)) : "You cannot assign the first value to a"
|
||||
@require $assignable(self.second, $typeof(*b)) : "You cannot assign the second value to b"
|
||||
@require $assignable(self.third, $typeof(*c)) : "You cannot assign the second value to c"
|
||||
*>
|
||||
macro void Triple.unpack(&self, a, b, c)
|
||||
{
|
||||
*a = self.first;
|
||||
*b = self.second;
|
||||
*c = self.third;
|
||||
}
|
||||
|
||||
module std::collections::tuple{Type1, Type2};
|
||||
|
||||
struct Tuple @deprecated("Use 'Pair' instead")
|
||||
|
||||
Reference in New Issue
Block a user