next up previous contents index
Next: omap Up: Graphcode Previous: objref   Contents   Index


Ptrlist

Ptrlists work a bit like std::vector<objref> -- objrefs can be added with Ptrlist::push_back(), indexed with standard array indexing Ptrlist::operator[], and iterated over in the usual way with Ptrlist::iterator. However, unlike std::vector<objref>, only pointers to the objref is stored within Ptrlist, not copies.

Synopsis:

class Ptrlist 
  {
  public:
    
    class iterator
    {
    public:
      objref& operator*();
      objref* operator->();
      iterator operator++();
      iterator operator--();
      iterator operator++(int);
      iterator operator--(int);
      bool operator==(const iterator& x);
      bool operator!=(const iterator& x);
    };
    iterator begin() const;
    iterator end() const;
    objref &    front ()
    objref &    back ()
    unsigned size() const;
    objref& operator[](unsigned i) const; 
    void push_back(objref* x);
    void push_back(objref& x);
    void erase(GraphID_t i);
    void clear();
    Ptrlist& operator=(const Ptrlist &x);
  };

Ptrlists can only refer to objects stored in objectMap. Ptrlists can be serialised -- Ptrlists must be unpacked within the context of an omapthe objectMap.

If you need to use a backing map, you can declare another omap object and assign objectMap to it. This will create copies of all the objects contained within objectMap.



Russell Standish 2016-09-02