Vcsn  2.3a
Be Rational
vcsn::to Class Reference

An exponent, or range of exponents. More...

#include <to.hh>

Collaboration diagram for vcsn::to:

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
 

Detailed Description

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;

Definition at line 25 of file to.hh.

Constructor & Destructor Documentation

vcsn::to::to ( int  min_,
int  max_ 
)
inline

Build a exponent range.

Parameters
min_the minimum number. If -1, denotes 0.
max_the maximum number. If -1, denotes infinity, using star. If -2, denotes the same value as min.

Definition at line 34 of file to.hh.

vcsn::to::to ( int  min_)
inline

Definition at line 48 of file to.hh.

vcsn::to::to ( unsigned  min_)
inline

Definition at line 52 of file to.hh.

Member Function Documentation

bool vcsn::to::finite ( ) const
inline

Whether the max exponent is finte.

Definition at line 57 of file to.hh.

References max.

bool vcsn::to::single ( ) const
inline

Whether features a single exponent.

Definition at line 63 of file to.hh.

References max, and min.

Member Data Documentation

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().


The documentation for this class was generated from the following file: