1

In the template class B's function Fb, type A::InnerA is error, how to define it.

error: ‘A::InnerA’ is not a type void Fb(A::InnerA* i) {

template <typename T>
class A {
public:
    class InnerA {
    public:
        T* get() {
            return _data;
        }
        void set(T* t) {
            _data = t;
        }
    private:
        T* _data;
    };

    void Fa(InnerA* i) {

    }
};


template <typename T>
class B {
public:
    void Fb(A<T>::InnerA* i) {
       _a.Fa(i);
    }
private:
    A<T> _a;
};

c++14 can compile by auto type, and what it's real type, how to define it?

template <typename T>
class B {
public:
    void Fb(auto i) {
       _a.Fa(i); 
    }
private: 
    A<T> _a;
};

Alex
  • 11
  • 3
  • sorry, A::InnerA is not a type, not A::InnerA error: ‘A::InnerA’ is not a type void Fb(A::InnerA* i) { – Alex Sep 26 '21 at 15:43
  • There are more problems then that in your code. `class B` is declared as a non-template class in `A`, but a template class outside for starters. – super Sep 26 '21 at 15:43

0 Answers0