Vcsn  2.1
Be Rational
strip.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/dyn/automaton.hh>
4 
5 namespace vcsn
6 {
7  namespace detail
8  {
9  // Rely on the fact that int takes precedence over long to express
10  // a precedence of this first function over the second one.
11 
12  // automata that feature a strip member function.
13  template <typename Aut>
14  inline
15  auto
16  strip(const Aut& aut, int)
17  -> decltype(aut->strip())
18  {
19  return aut->strip();
20  }
21 
22  // automata that don't feature a strip member function.
23  template <typename Aut>
24  inline
25  auto
26  strip(const Aut& aut, long)
27  -> decltype(aut)
28  {
29  return aut;
30  }
31  }
32 
34  template <typename Aut>
35  inline
36  auto
37  strip(const Aut& aut)
38  -> decltype(detail::strip(aut, 0))
39  {
40  return detail::strip(aut, 0);
41  }
42 
43  namespace dyn
44  {
45  namespace detail
46  {
48  template <typename Aut>
49  inline
50  automaton
51  strip(const automaton& aut)
52  {
53  const auto& a = aut->as<Aut>();
54  return make_automaton(::vcsn::strip(a));
55  }
56  }
57  }
58 } // vcsn::
auto strip(const Aut &aut, int) -> decltype(aut->strip())
Definition: strip.hh:16
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
Definition: automaton.hh:75
std::shared_ptr< detail::automaton_base > automaton
Definition: automaton.hh:69
automaton strip(const automaton &aut)
Bridge.
Definition: strip.hh:51
auto strip(const Aut &aut) -> decltype(detail::strip(aut, 0))
Remove (all) the decorations from a decorated automaton.
Definition: strip.hh:37