Vcsn  2.2
Be Rational
is-proper.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <type_traits>
4 
5 #include <vcsn/ctx/traits.hh>
7 #include <vcsn/core/kind.hh>
8 #include <vcsn/dyn/automaton.hh> // make_automaton
9 
10 namespace vcsn
11 {
12 
13  namespace detail
14  {
15  template <Automaton Aut>
16  inline
17  std::enable_if_t<labelset_t_of<Aut>::has_one(), bool>
18  is_proper_(const Aut& aut)
19  {
20  for (auto t: transitions(aut))
21  if (aut->labelset()->is_one(aut->label_of(t)))
22  return false;
23  return true;
24  }
25 
26  template <Automaton Aut>
27  inline constexpr
28  std::enable_if_t<!labelset_t_of<Aut>::has_one(), bool>
29  is_proper_(const Aut&)
30  {
31  return true;
32  }
33  }
34 
42  template <Automaton Aut>
43  bool is_proper(const Aut& aut) ATTRIBUTE_CONST;
44 
45  template <Automaton Aut>
46  inline
47  bool
48  is_proper(const Aut& aut)
49  {
50  return detail::is_proper_(aut);
51  }
52 
53  namespace dyn
54  {
55  namespace detail
56  {
58  template <Automaton Aut>
59  inline
60  bool is_proper(const automaton& aut)
61  {
62  const auto& a = aut->as<Aut>();
63  return is_proper(a);
64  }
65  }
66  }
67 } // namespace vcsn
bool is_proper(const Aut &aut)
Test whether an automaton is proper.
Definition: is-proper.hh:48
bool is_proper(const automaton &aut)
Bridge.
Definition: is-proper.hh:60
Definition: a-star.hh:8
std::enable_if_t< labelset_t_of< Aut >::has_one(), bool > is_proper_(const Aut &aut)
Definition: is-proper.hh:18
std::shared_ptr< detail::automaton_base > automaton
Definition: automaton.hh:69
auto transitions(const Aut &aut) -> decltype(all_transitions(aut, is_special_t< Aut >
All the transition indexes between visible states.
Definition: automaton.hh:218