Category: iterators | Component type: type |
class my_bidirectional_iterator : public bidirectional_iterator<double> { ... };This declares my_bidirectional_iterator to be a Bidirectional Iterator whose value type is double and whose distance type is ptrdiff_t. If Iter is an object of class my_bidirectional_iterator, then iterator_category(Iter) will return bidirectional_iterator_tag(), value_type(Iter) will return (double*) 0, and distance_type(Iter) will return (ptrdiff_t*) 0.
Parameter | Description | Default |
---|---|---|
T | The iterator's value type | |
Distance | The iterator's distance type | ptrdiff_t |
[1] It is not required that a Bidirectional Iterator inherit from the base bidirectional_iterator. It is, however, required that the functions iterator_category, distance_type, and value_type be defined for every Bidirectional Iterator. (Or, if you are using the iterator_traits mechanism, that iterator_traits is properly specialized for every Bidirectional Iterator.) Since those functions are defined for the base bidirectional_iterator, the easiest way to ensure that are defined for a new type is to derive that class from bidirectional_iterator and rely on the derived-to-base standard conversion of function arguments.
privacy policy | | | contact us |
Copyright © 1993-2001 Silicon Graphics, Inc. All rights reserved. | | | Trademark Information |