Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. NAME __distance_type - Determines the type of distance used by an iterator. This function is now obsolete. It is retained in order to include backward compatibility and support compilers that do not include partial specialization. SYNOPSIS #include <iterator> template <class Category, class T, class Distance, class Pointer, class Reference> inline Distance* __distance_type(const iterator<Category, T, Distance, Pointer, Reference>&); template <class T> inline ptrdiff_t* __distance_type (const T*); DESCRIPTION The __distance_type family of function templates return a pointer to a value that is of the same type as that used to represent a distance between two iterators. The first of these take an iterator of a particular type and return a pointer to a default value of the difference_type for that iterator. The T* form of the function returns ptrdiff_t*. Generic algorithms use this function to create local vari- ables of the correct type. The __distance_type functions are typically used like this: template <class Iterator> void foo(Iterator first, Iterator last) { __foo(begin,end,__distance_type(first)); } template <class Iterator, class Distance> void __foo(Iterator first, Iterator last, Distance*> { Distance d = Distance(); distance(first,last,d); } The auxiliary function template allows the algorithm to extract a distance type from the first iterator and then use that type to perform some useful work. SEE ALSO Other iterator primitives: __value_type, __iterator_category, distance, advance
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |