bidirectional iterator


bidirectional_iterator<T, Distance> bidirectional_iterator<T, Distance> Category: iterators Component type: type Description Bidirectional_iterator is an iterator base class: it is intended that an iterator that is a model of Bidirectional Iterator, and whose value type and distance type are T and Distance, may be defined by inheriting from bidirectional_iterator<T, Distance> [1]. Bidirectional_iterator is entirely empty: it has no member functions, member variables, or nested types. It exists solely to simplify the definition of the functions iterator_category, distance_type, and value_type. Example 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. Definition Defined in the standard header iterator, and in the nonstandard backward-compatibility header iterator.h. This class is no longer part of the C++ standard, although it was present in early drafts of the standard. It is retained in this implementation for backward compatibility. Template parameters Parameter Description Default T The iterator's value type   Distance The iterator's distance type ptrdiff_t Model of Assignable Public base classes None Type requirements The distance type must be a signed integral type. Public base classes None. Members None. New Members None. Notes [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. See also The Iterator Tags overview, iterator_traits, iterator_category, value_type, distance_type, input_iterator, output_iterator, forward_iterator, random_access_iterator Copyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation

Wyszukiwarka

Podobne podstrony:
bidirectional iterator tag
plan for next iteration?CDF5AB
plan for next iteration?855DCD
plan for next iteration?CDF5AB
iterator?tegory
manage iteration+95C965
prepare environment for an iteration@2D3B0A
front insert iterator
plan for next iterationU840038
elaboration iteration EF1118
develop iteration plan?B6B1EE
prepare environment for an iteration?05D5FC
support environment during an iterationF0693E
manage iteration?22F596
random?cess iterator
plan for next iteration?4E6051

więcej podobnych podstron