What is the "data" member mean?

  • 1

    I don't know what is the "*data" used for?
    Can someone give some detail explanation?

    class Iterator {
    struct Data;
    Data* data;
    Iterator(const vector<int>& nums);
    Iterator(const Iterator& iter);
    virtual ~Iterator();
    // Returns the next element in the iteration.
    int next();
    // Returns true if the iteration has more elements.
    bool hasNext() const;

  • 1

    I think you need not consider what the "Data" types means. You need just operate the method provided in the class Iterator.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.