迭代器的概念

Author: David Abrahams, Jeremy Siek, Thomas Witt
Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com
Organization: Boost Consulting, Indiana University Open Systems Lab, Zephyr Associates, Inc.
Date: 2006-09-11
Copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2004.
概要: 迭代器概念檢查類為模板提供了一個機制,當用戶以一個不滿足模板要求的類型去對模板進行實例化時,可以得到更清晰的錯誤信息。

有關使用概念檢查類的介紹,請看 boost::concept_check 庫的文檔。

參考

iterator_concepts.hpp 概要

namespace boost_concepts {

// 迭代器訪問概念

template <typename Iterator>
class ReadableIteratorConcept;

template <
typename Iterator
, typename ValueType = std::iterator_traits<Iterator>::value_type
>
class WritableIteratorConcept;

template <typename Iterator>
class SwappableIteratorConcept;

template <typename Iterator>
class LvalueIteratorConcept;

// 迭代器遍歷概念

template <typename Iterator>
class IncrementableIteratorConcept;

template <typename Iterator>
class SinglePassIteratorConcept;

template <typename Iterator>
class ForwardTraversalConcept;

template <typename Iterator>
class BidirectionalTraversalConcept;

template <typename Iterator>
class RandomAccessTraversalConcept;

// 可交互性

template <typename Iterator, typename ConstIterator>
class InteroperableIteratorConcept;

}