Vcsn  2.1
Be Rational
traits.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
6 
7 namespace vcsn
8 {
9 
11  template <typename T>
13 
14  /*------------------.
15  | Computing types. |
16  `------------------*/
17 
25 
26 #define DEFINE(Type) \
27  namespace detail \
28  { \
29  template <typename ValueSet> \
30  struct Type ## _of_impl \
31  { \
32  using type = typename ValueSet::Type; \
33  }; \
34  \
35  template <typename ValueSet> \
36  struct Type ## _of_impl<std::shared_ptr<ValueSet>> \
37  : Type ## _of_impl<base_t<ValueSet>> \
38  {}; \
39  } \
40  \
41  template <typename ValueSet> \
42  using Type ## _of \
43  = typename detail::Type ## _of_impl<base_t<ValueSet>>::type
44 
45  DEFINE(context_t);
46  DEFINE(label_t);
47  DEFINE(labelset_t);
48  DEFINE(state_t);
49  DEFINE(transition_t);
50  DEFINE(weight_t);
51  DEFINE(weightset_t);
52 
53 #undef DEFINE
54 
55  template <typename Aut, typename Context = context_t_of<Aut>>
57  = typename Aut::element_type::template fresh_automaton_t<Context>;
58 
59  template <typename ValueSet>
60  using letter_t_of
61  = typename labelset_t_of<base_t<ValueSet>>::letter_t;
62 
63  template <typename ValueSet>
64  using word_t_of
65  = typename labelset_t_of<base_t<ValueSet>>::word_t;
66 }
remove_cv_t< remove_reference_t< T >> base_t
T without reference or const/volatile qualifiers.
Definition: traits.hh:12
typename std::remove_cv< T >::type remove_cv_t
Definition: type_traits.hh:25
#define DEFINE(Type)
Extract various ValueSets/Value types from objects, or pointers to objects.
Definition: traits.hh:26
typename labelset_t_of< base_t< ValueSet >>::letter_t letter_t_of
Definition: traits.hh:61
typename Aut::element_type::template fresh_automaton_t< Context > fresh_automaton_t_of
Definition: traits.hh:57
typename labelset_t_of< base_t< ValueSet >>::word_t word_t_of
Definition: traits.hh:65
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
Definition: traits.hh:47