[Solved] How to access members of a template class [closed]


So it looks like you have this:

struct Obj
{
    int x_;
};

template <typename T>
struct Struct
{
    std::vector<T> items_;
};

So to access an element (assuming you added it to the vector):

int main()
{
    Struct s;
    s.items_.resize(10);
    s.items_[0].x_ = 5; // Access the object memeber of element 0 in the vector.
}

solved How to access members of a template class [closed]