Vcsn  2.2a
Be Rational
join.hh
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace vcsn
6 {
7  namespace detail
8  {
9 
16  template <typename V1, typename V2,
17  typename Enable = void>
18  struct join_impl
19  {};
20 
24  template <typename V1, typename V2>
26  join_(V1 v1, V2 v2, int)
27  {
28  return join_impl<V1, V2>::join(v1, v2);
29  }
30 
31  template <typename V1, typename V2>
33  join_(V2 v2, V1 v1, long)
34  {
35  return join_impl<V1, V2>::join(v1, v2);
36  }
37  }
38 
42  template <typename ValueSet>
43  auto
44  join(const ValueSet& vs)
45  -> ValueSet
46  {
47  return vs;
48  }
49 
51  template <typename ValueSet1, typename ValueSet2>
52  auto
53  join(ValueSet1 vs1, ValueSet2 vs2)
54  -> decltype(detail::join_(vs1, vs2, 0))
55  {
56  return detail::join_(vs1, vs2, 0);
57  }
58 
68  template <typename ValueSet1, typename ValueSet2, typename ValueSet3,
69  typename... VSs>
70  auto
71  join(ValueSet1 vs1, ValueSet2 vs2, ValueSet3 vs3, VSs&&... vs)
72  {
73  return join(join(vs1, vs2), vs3, std::forward<VSs>(vs)...);
74  }
75 
77  template <typename... ValueSets>
78  using join_t = decltype(join(std::declval<ValueSets>()...));
79 }
80 
84 #define VCSN_JOIN_SIMPLE(Lhs, Rhs) \
85  \
86  template <> \
87  struct join_impl<Lhs, Rhs> \
88  { \
89  using type = Rhs; \
90  static type join(Lhs, Rhs) \
91  { \
92  return {}; \
93  } \
94  }
A structure that implements the computation of join(V1, V2).
Definition: join.hh:18
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:206
auto join(const ValueSet &vs) -> ValueSet
The join of a single valueset.
Definition: join.hh:44
decltype(join(std::declval< ValueSets >()...)) join_t
The type of the join of the ValueSets.
Definition: join.hh:78
join_impl< V1, V2 >::type join_(V1 v1, V2 v2, int)
Dealing with commutativity: two implementations of join_: forward and reversed, ordered by preference...
Definition: join.hh:26
auto join(ValueSet1 vs1, ValueSet2 vs2, ValueSet3 vs3, VSs &&...vs)
The join of three (or more) valuesets.
Definition: join.hh:71
Definition: a-star.hh:8