EDIT: I am trying to provide a type/structure overview, so please be patient if you want/need more details about my question
I am writing a solver where I have to represent the domain of each variable. I was wondering what would be the best ways to store the domain information, knowing that a (discrete) domain is a set (ordered or not) of
- integers (1 byte)
- an interval with unit steps (2 bytes)
- an interval with arbitrary steps (3 bytes)
I can possibly convert intervals into a vector of integers, exchanging space for speed and simplicity.
Eventually, I would like to consider continuous domains too, but it is easy to represent intervals.
My question is, what would be the best way to represent such discrete domains considering time efficiency. Is it better to make a union of the three types (each with different size) or artificially make all of them either 1. or 3. ?
As it is for the general case, I don’t have specific use case of how the domains are.