======= Domains ======= Domains are intented to allow for the interpretation and manipulation of values of different types (text, integers, tuples and so on) using an internal representation based on integers. In short, a domain provides ways to translate what we call *domain values* into *internal values* and vice-versa. With domains, we will be able to create algebras (and, consequently, matrices) capable of dealing with values other than integers, while keeping the internal operations only over integers. .. note:: The data types to be used in a domain need at least to provide a weak strict ordering implementation (in the :cpp:func:`operator<()` method), as internally we use the domain values as keys in a map. For example, below we create a domain over strings: .. code-block:: cpp ct4l::Domain domain {"T", "I", "F"}; What happens internally is that the value `"T"` is mapped into the value `0`, `"I"` to the value 1 and `"F"` to the value `2`. We can then use the methods :cpp:func:`ct4l::Domain::to_domain()` and :cpp:func:`ct4l::Domain::to_internal()` in order to translate values from one representation into the other: .. code-block:: cpp std::string internal_value_of_T = domain.to_internal("T"); // the value 0 int domain_value_of_1 = domain.to_domain(1); // the value "I" These methods are also implemented over containers `vector` and `set` in the natural way. Below we offer another example, in which the domain values are pairs of integers, something common when dealing with product algebras or matrices: .. code-block:: cpp using IntPair = std::pair; ct4l::Domain prod_domain = { {0, 0}, {0, 1}, {1, 0}, {1, 1} }; --- API --- .. doxygenclass:: ct4l::Domain :members: