17 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_LETTER_RANGE_HXX
18 # define VCSN_ALGEBRA_IMPLEMENTATION_LETTER_RANGE_HXX
29 template <
class T,
class Interval>
30 static_ranged<T, Interval>::static_ranged()
33 template <
class T,
class Interval>
34 static_ranged<T, Interval>::static_ranged(
const T& v)
36 if (Interval::check(v))
39 value_ = Interval::from();
42 template <
class T,
class Interval>
43 static_ranged<T, Interval>::static_ranged(
const static_ranged& o) :
47 template <
class T,
class Interval>
48 static_ranged<T, Interval>::operator T()
const
53 template <
class T,
class Interval>
54 bool operator<(const static_ranged<T, Interval>& lhs,
55 const static_ranged<T, Interval>& rhs)
57 return lhs.value() < rhs.value();
60 template <
class T,
class Interval>
61 bool operator==(
const static_ranged<T, Interval>& lhs,
62 const static_ranged<T, Interval>& rhs)
64 return lhs.value() == rhs.value();
67 template <
class T,
class Interval>
68 const T& static_ranged<T, Interval>::value()
const
73 template <
class T,
class Interval>
74 T& static_ranged<T, Interval>::value()
79 template <
class T,
class Interval>
80 static_ranged<T, Interval>
81 static_ranged<T, Interval>::randomized()
83 value_ = Interval::random();
87 template <
char From,
char To>
89 static_char_interval<From, To>::check(
char c)
91 return ((c >= From) && (c <= To));
94 template <
char From,
char To>
95 char static_char_interval<From, To>::from()
100 template <
char From,
char To>
101 char static_char_interval<From, To>::to()
106 template <
char From,
char To>
107 char static_char_interval<From, To>::random()
109 unsigned r = floor((
float (rand()) / RAND_MAX) * (To - From + 1));
110 return (
char)(From + r);
117 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_LETTER_RANGE_HXX