私はこのテンプレート機能があります。 template <class P>
double Determinant(const P & a, const P & b, const P & c) {
return (b.x-a.x)*(c.y-a.y) - (c.x-a.x)*(b.y-a.y);
}
が、私はdoubleにすべての時間を戻り値の型を強制的に避けたい - P :: x
thesepostsで働いていると、私は自分のタイプを少なくとも少しは理解していると思っていました。 だから私は期待通りに失敗した例を作成しました: scala> trait A { val v = "a" }
defined trait A
scala> trait B { this :A => ; var v = "" ; this.v = "b" }
<console>:6: err