17 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_ALPHABET_SET_HXX
18 # define VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_ALPHABET_SET_HXX
22 # include <vaucanson/algebra/concept/letter.hh>
23 # include <vaucanson/algebra/implementation/alphabets/alphabet_set.hh>
33 # define ALPHABET_TRAITS \
34 alphabet_traits<AlphabetSet<L>, std::set<L> >
37 inline typename ALPHABET_TRAITS::first_projection_t
38 ALPHABET_TRAITS::first_projection(
const ALPHABET_TRAITS::alphabet_t& A)
41 static_assertion_(not (misc::static_eq<first_projection_t,
42 undefined_type>::value), need_first_projection);
46 for_all_const_(alphabet_t, i, A)
56 inline typename ALPHABET_TRAITS::second_projection_t
57 ALPHABET_TRAITS::second_projection(
const ALPHABET_TRAITS::alphabet_t& A)
60 static_assertion_(not (misc::static_eq<second_projection_t,
61 undefined_type>::value), need_second_projection);
63 second_projection_t R;
65 for_all_const_(alphabet_t, i, A)
68 R.insert((*i).second);
74 # undef ALPHABET_TRAITS
82 op_max_size(
const algebra::AlphabetSet<L>&,
const std::set<L>&)
84 return algebra::letter_traits<L>::cardinal;
88 bool op_contains(
const algebra::AlphabetSet<L>&,
const std::set<L>&)
94 bool op_is_finite(
const algebra::AlphabetSet<L>&,
const std::set<L>&)
100 bool op_contains_e(
const algebra::AlphabetSet<L>&,
const std::set<L>& a,
103 return a.find(v) != a.end();
106 template <
typename L>
109 const std::set<L>& v,
110 const std::string& in,
114 typedef std::string::const_iterator iter_t;
119 size_t ret_pos = pos;
122 size_t current_pos = pos;
123 std::string current_letter_rep =
"";
125 for (iter_t i = in.begin() + pos; i != in.end(); ++i)
127 std::pair<bool, L> tmp;
128 current_letter_rep += *i;
130 tmp = letter_traits<L>::literal_to_letter(current_letter_rep);
131 if (tmp.first && op_contains_e(s, v, tmp.second))
134 ret_letter = tmp.second;
135 ret_pos = current_pos;
140 return std::make_pair(ret, ret_letter);
147 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_ALPHABET_SET_HXX