public std::iterator<std::forward_iterator_tag, value_type> {
friend class container;
public:
public std::iterator<std::forward_iterator_tag, value_type> {
friend class container;
public:
- const value_type& operator*() const;
+ const value_type& operator*() const;
const value_type* operator->() const;
const value_type* operator->() const;
- const_iterator& operator++();
+ const_iterator& operator++();
const_iterator operator++(int);
friend bool operator==(const_iterator lhs,
const_iterator rhs);
const_iterator operator++(int);
friend bool operator==(const_iterator lhs,
const_iterator rhs);
There are normally only three member functions that need nontrivial
implementations; the rest are just boilerplate.
There are normally only three member functions that need nontrivial
implementations; the rest are just boilerplate.
- const container::value_type&
+ const container::value_type&
container::const_iterator::operator*() const {
// find the element and return a reference to it
}
const container::value_type*
container::const_iterator::operator->() const {
container::const_iterator::operator*() const {
// find the element and return a reference to it
}
const container::value_type*
container::const_iterator::operator->() const {
}
If there's an underlying real container, operator*() can just return a
}
If there's an underlying real container, operator*() can just return a
The operator->() function is just boilerplate around a call to
operator*().
The operator->() function is just boilerplate around a call to
operator*().
- container::const_iterator&
+ container::const_iterator&
container::const_iterator::operator++() {
// the incrementing logic goes here
return *this;
container::const_iterator::operator++() {
// the incrementing logic goes here
return *this;
friend class container;
friend class container::const_iterator;
public:
friend class container;
friend class container::const_iterator;
public:
- value_type& operator*() const;
+ value_type& operator*() const;
value_type* operator->() const;
value_type* operator->() const;
- iterator& operator++();
+ iterator& operator++();
iterator operator++(int);
friend bool operator==(iterator lhs, iterator rhs);
friend bool operator!=(iterator lhs, iterator rhs);
iterator operator++(int);
friend bool operator==(iterator lhs, iterator rhs);
friend bool operator!=(iterator lhs, iterator rhs);
friend class container;
public:
const_iterator();
friend class container;
public:
const_iterator();
- const_iterator(const iterator& i);
- const value_type& operator*() const;
+ const_iterator(const iterator& i);
+ const value_type& operator*() const;
const value_type* operator->() const;
const value_type* operator->() const;
- const_iterator& operator++();
+ const_iterator& operator++();
const_iterator operator++(int);
friend bool operator==(const_iterator lhs,
const_iterator rhs);
const_iterator operator++(int);
friend bool operator==(const_iterator lhs,
const_iterator rhs);
public std::iterator<std::bidirectional_iterator_tag, value_type> {
public:
//...
public std::iterator<std::bidirectional_iterator_tag, value_type> {
public:
//...
- iterator& operator--();
+ iterator& operator--();
iterator operator--(int);
//...
};
iterator operator--(int);
//...
};
public std::iterator<std::random_access_iterator_tag, value_type> {
public:
//...
public std::iterator<std::random_access_iterator_tag, value_type> {
public:
//...
- iterator& operator+=(difference_type rhs);
- iterator& operator-=(difference_type rhs);
+ iterator& operator+=(difference_type rhs);
+ iterator& operator-=(difference_type rhs);
friend iterator operator+(iterator lhs, difference_type rhs);
friend iterator operator+(difference_type lhs, iterator rhs);
friend iterator operator-(iterator lhs, difference_type rhs);
friend iterator operator+(iterator lhs, difference_type rhs);
friend iterator operator+(difference_type lhs, iterator rhs);
friend iterator operator-(iterator lhs, difference_type rhs);
+ container::iterator&
container::iterator::operator+=(container::difference_type rhs) {
// add rhs to iterator position
return *this;
}
container::iterator::operator+=(container::difference_type rhs) {
// add rhs to iterator position
return *this;
}
+ container::iterator&
container::iterator::operator-=(container::difference_type rhs) {
// subtract rhs from iterator position
return *this;
container::iterator::operator-=(container::difference_type rhs) {
// subtract rhs from iterator position
return *this;
<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
<!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
<!-- hhmts start -->
<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
<!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
<!-- hhmts start -->
-Last modified: Sun Jan 20 13:01:02 CST 2002
+Last modified: Wed Apr 23 11:20:49 CDT 2003
<!-- hhmts end -->
</font>
</body></html>
<!-- hhmts end -->
</font>
</body></html>