2004-12-03から1日間の記事一覧
id:ototoiさんに指摘していただいたように const Item&型メンバをconst T&型メンバに変更してみました。 このやり方だとconst T型、つまり値でもいけるみたいです。逆にメンバじゃなく演算子関数の引数のほうでは値は使えません。 const ItemのようなReferen…
あぅ・・CRTPだとreferenceにしないとスライシングがあ;; 意味ないじゃん><
おととひさんのためになるお話(id:ototoi:20041126)を忘れないように・・ついでにETの土台をつくってみる #include template struct Item { const T& Self() const { return static_cast(*this); } };template struct Plus:public Item { Plus(const Item& t…