Added unpack macro for Triple (#2277)

This commit is contained in:
Ero Mrinin
2025-07-09 05:11:13 +04:00
committed by GitHub
parent a314e05826
commit 123b1c8f44

View File

@@ -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")