- iterator begin(DataType type = DataType::NIL)
- { return iterator(*this, type, 0); }
-
- iterator end(DataType type = DataType::NIL)
- {
- return iterator(*this, type,
- (type == DataType::NIL) ? _count.get_total() : _count.get(type));
- }
-
- // FIXME: typeify
- class const_iterator {
- public:
-
- const Port& operator*() { return *_set.port(_index); }
- const Port* operator->() { return _set.port(_index); }
- const_iterator& operator++() { ++_index; return *this; } // yes, prefix only
- bool operator==(const const_iterator& other) { return (_index == other._index); }
- bool operator!=(const const_iterator& other) { return (_index != other._index); }
-
- private:
- friend class PortSet;
+ typedef iterator_base<PortSet, Port> iterator;
+ typedef iterator_base<const PortSet, const Port> const_iterator;