Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented Nov 14, 2025

Previously, one could approximate a Flat lattice whose elements could
have multiple types by creating a Flat lattice of a variant type.
However, this would produce elements that were variants of variants,
wasting space on an extra discriminant. To make this use case more
efficient and ergonomic, support taking multiple type parameters in
Flat. The multiple type parameters all become part of the element
variant type. To handle the case where types are repeated, also add
element accessors templatized on the type index.

Previously, one could approximate a Flat lattice whose elements could
have multiple types by creating a Flat lattice of a variant type.
However, this would produce elements that were variants of variants,
wasting space on an extra discriminant. To make this use case more
efficient and ergonomic, support taking multiple type parameters in
Flat. The multiple type parameters all become part of the element
variant type. To handle the case where types are repeated, also add
element accessors templatized on the type index.
@tlively tlively requested a review from kripken November 14, 2025 23:09
return false;
},
*this,
other);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can guess at what this line does, but where in the docs is it described? I can't seem to find that (the variant of visit with two objects after the lambda)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::visit is fun because it can take an arbitrary number of std::variant arguments as long as the visitor functions can take that same number of parameters. See the Variants&&... values variadic parameter given in https://en.cppreference.com/w/cpp/utility/variant/visit2.html.

@tlively tlively merged commit fc33745 into main Nov 15, 2025
16 checks passed
@tlively tlively deleted the generalize-flat-lattice branch November 15, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants