19 template<
typename... X>
20 class CtcUnion :
public Ctc<CtcUnion<X...>,X...>
24 explicit CtcUnion(Index n)
25 : Ctc<CtcUnion<X...>,X...>(n)
27 if constexpr(std::is_same_v<X...,Interval>)
28 assert_release(n == 1);
32 requires (IsCtcBaseOrPtr<C,X...> && !std::is_same_v<CtcUnion<X...>,C>)
34 : Ctc<CtcUnion<X...>,X...>(size_of(c)), _ctcs(c)
37 template<
typename... C>
38 requires (IsCtcBaseOrPtr<C,X...> && ...)
39 CtcUnion(
const C&... c)
40 : Ctc<CtcUnion<X...>,X...>(size_first_item(c...)), _ctcs(c...)
42 assert_release(all_same_size(c...));
46 void contract_impl(X_& x)
const
51 for(
const auto& ci : _ctcs)
54 ci->contract(saved_x);
61 void contract(X&... x)
const
68 requires std::is_base_of_v<CtcBase<X...>,C>
69 CtcUnion<X...>& operator|=(
const C& c)
71 assert_release(c.size() == this->size());
72 _ctcs.push_object_back(c);
76 CtcUnion<X...>& operator|=(
const std::shared_ptr<CtcBase<X...>>& c)
78 assert_release(c->size() == this->size());
85 Collection<CtcBase<X...>> _ctcs;
89 class CtcUnion<> :
public CtcUnion<IntervalVector>
92 template<
typename Tuple>
95 template<
typename... T>
96 struct CtcUnionType<std::tuple<T...>> {
97 using Ctc = CtcUnion<T...>;
100 template<
typename C1,
typename C2>
101 typename CtcUnionType<typename C1::ContractedTypes>::Ctc operator|(
const C1& c1,
const C2& c2)
106 template<
typename C2>
107 requires std::is_base_of_v<CtcBase<IntervalVector>,C2>
108 inline CtcUnion<IntervalVector> operator|(
const IntervalVector& c1,
const C2& c2)
110 assert_release(c1.size() == c2.size());
111 return CtcUnion<IntervalVector>(CtcWrapper(c1),c2);
114 template<
typename C1>
115 requires std::is_base_of_v<CtcBase<IntervalVector>,C1>
116 inline CtcUnion<IntervalVector> operator|(
const C1& c1,
const IntervalVector& c2)
118 assert_release(c1.size() == c2.size());
119 return CtcUnion<IntervalVector>(c1,CtcWrapper(c2));