![]() |
Vcsn
2.4
Be Rational
|
An exponent, or range of exponents. More...
#include <to.hh>
Public Member Functions | |
| to (int min_, int max_) | |
| Build a exponent range. More... | |
| to (int min_) | |
| to (unsigned min_) | |
| bool | finite () const |
| Whether the max exponent is finte. More... | |
| bool | single () const |
| Whether features a single exponent. More... | |
Public Attributes | |
| int | min |
| int | max |
An exponent, or range of exponents.
The purpose of this class is to model exponents such as in a{2}, a{2, 3}, a{-1} etc. To support them, we used to rely on overloads, e.g.,
auto multiply(weight, weight) -> weight; auto multiply(weight, int min, int max = min) -> weight;
unfortunately when on Z, both signatures collide, but not exactly, so the compiler chose the "best" one, which resulted in 3 * 3 = 27 in Z. In turn, this results in <3><3>a = <27>a in Z.
To avoid this collision, we decided that the second signature would be
auto multiply(weight, to{int min, int max = min}) -> weight;
|
inline |
|
inline |
|
inline |
| int vcsn::to::max |
Definition at line 69 of file to.hh.
Referenced by finite(), vcsn::if(), vcsn::operator<<(), and single().
| int vcsn::to::min |
Definition at line 68 of file to.hh.
Referenced by vcsn::if(), vcsn::operator<<(), and single().