4

クラスに typedef を追加しようとしていますが、コンパイラは次のコードで構文エラーを報告します。

    template<class T>
    class MyClass{
        typedef std::vector<T> storageType; //this is fine
        typedef storageType::iterator iterator; //the error is here

しかし、次も機能しません:

        typedef std::vector<T>::iterator iterator;

多くのフォーラムで回答を探していましたが、解決策や回避策が見つかりません。ご協力ありがとうございました!

4

2 に答える 2