- 论坛徽章:
- 0
|
- size_type size() const {
- size_type __result = distance(begin(), end());
- return __result;
- }
- template <class _InputIterator>
- inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
- distance(const _InputIterator& __first, const _InputIterator& __last) {
- return __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
- }
- template <class _InputIterator>
- inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
- __distance(const _InputIterator& __first, const _InputIterator& __last, const input_iterator_tag &) {
- _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0;
- _InputIterator __it(__first);
- while (__it != __last) {
- ++__it; ++__n;
- }
- return __n;
- }
复制代码 |
|