C++ コードの一部に問題があります。
まず、これを行うと、非常にうまく機能します。
struct A
{
using my_type1 = double;
using my_type2 = int;
};
struct B
{
using size_type = A::my_type2;
};
ただし、my_type1 を選択できるようにしたいので、テンプレートの方法を使用しました。
template <typename T>
struct A
{
using my_type1 = T;
using my_type2 = int;
};
template <typename T>
struct B
{
using size_type = A<T>::my_type2;
};
ここで、gcc は次の行で失敗します: "expected type specifier"
using size_type = A<T>::my_type2;
テンプレートに my_type2 を入れることもできますが、これはあまり変更すべきではないタイプです。
では、なぜ私の方法が機能しないのですか? ありがとう!