C++0xにはdefault template parameterがあるらしいです

ので取りあえずソレを使ってみてかわいそうな事をしてみたのですが

int main()
{
    Or<A,B> o = or_intro1<A,B>(A());
    C c = or_elim(o,impl_intro(f),impl_intro(g));
 
    //↓だとオッケー   
    //C c = or_elim(or_intro1<A,B>(A()),impl_intro(f),impl_intro(g));
}

error: no matching function for call to 'or_elim(Or<A, B, Either>&, Impl<A, C>, Impl<B, C>)'

or_intro1自体の返値の型は、Orです。

template<typename A,typename B>
Or<A,B,Left> or_intro1(A a)

んでもって、Orの宣言ではOrみたいな事(ここでデフォルトをEitherに!!)をしていて、悲しいのは

Or が Orのsubtype
Or が Orのsubtypeみたいな。

template<typename A,typename B,typename C = Either>
class Or ...

template<typename A,typename B>
class Or<A,B,Left> : public Or<A,B,Either> ...

template<typename A,typename B>
class Or<A,B,Right> : public Or<A,B,Either> ...

このsubtype関係にしているので、取りあえず代入自体はパスするのですが・・・。

or_elim自体はOrとOrで場合分けしてます。

template<typename A,typename B,typename C>
C or_elim(Or<A,B,Left> a_or_b,Impl<A,C> a_impl_c,Impl<B,C> b_impl_c)
template<typename A,typename B,typename C>
C or_elim(Or<A,B,Right> a_or_b,Impl<A,C> a_impl_c,Impl<B,C> b_impl_c)

諦めて

Or<A,B,Left> o = or_intro1<A,B>(A());

とか書けボケがという感じだと思うのですが、自然演繹を(変に)模した感じにしたいので、どっちの証明が入ってるかとか「それが見えたり、書いたりするのは」嫌なわけです。

やり方を根本的に変えろっていう話はソレで、ソレは変えますが、これ自体をソレっぽく解決する雰囲気は無いかなぁ。