Vcsn  2.3
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, the two 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 26 of file to.hh.

Constructor & Destructor Documentation

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

Build a exponent range.

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

Definition at line 35 of file to.hh.

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

Definition at line 49 of file to.hh.

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

Definition at line 53 of file to.hh.

Member Function Documentation

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

Whether the max exponent is finte.

Definition at line 58 of file to.hh.

References max.

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

Whether features a single exponent.

Definition at line 64 of file to.hh.

References max, and min.

Member Data Documentation

int vcsn::to::max

Definition at line 70 of file to.hh.

Referenced by finite(), vcsn::if(), vcsn::operator<<(), and single().

int vcsn::to::min

Definition at line 69 of file to.hh.

Referenced by vcsn::if(), vcsn::operator<<(), and single().


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