*編集: どういうわけか、コンパイラがasを作成していると思ったので、継承/派生に関係なく、is_same がそれらをどのように評価するかについての私の仮定につながりました。私の悪い:(その後の誤解については申し訳ありません:\ *B
A<int, int, string>
カスタムタイプをチェックするためにいくつかのメタ関数を作成し、この問題に遭遇しましたが、ここで何が起こっているのかわかりません。既知の型の this_t メンバーを、渡されたパラメーターの this_t と比較することで回避できると思いますが、1 番目と 3 番目の is_same テストが失敗する理由を理解したいだけです。
template<typename... Args> struct A {
typedef A<Args...> this_t;
};
struct B : A<int, int, string> {
};
//tests
std::is_same<A<int, int, string>, B>::value; //false
std::is_same<A<int, int, string>, typename B::this_t>::value; //true
std::is_same<B, typename B::this_t>::value; //false
//more tests for kicks
std::is_base_of<A<int, int, string>, B>::value; //true
std::is_base_of<A<int, int, string>, typename B::this_t>::value; //true
std::is_base_of<B, typename B::this_t>::value; //false
is_same はA<...>
ベースによって差別化されていますか? A<int, int, string>
との明らかな違いは何B
ですか?