iterator_adaptor_body.rst
来自「Boost provides free peer-reviewed portab」· RST 代码 · 共 44 行
RST
44 行
.. Distributed under the Boost.. Software License, Version 1.0. (See accompanying.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).. Version 1.2 of this ReStructuredText document corresponds to n1530_, the paper accepted by the LWG for TR1... Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. The ``iterator_adaptor`` class template adapts some ``Base`` [#base]_type to create a new iterator. Instantiations of ``iterator_adaptor``are derived from a corresponding instantiation of ``iterator_facade``and implement the core behaviors in terms of the ``Base`` type. Inessence, ``iterator_adaptor`` merely forwards all operations to aninstance of the ``Base`` type, which it stores as a member... [#base] The term "Base" here does not refer to a base class and is not meant to imply the use of derivation. We have followed the lead of the standard library, which provides a base() function to access the underlying iterator object of a ``reverse_iterator`` adaptor.The user of ``iterator_adaptor`` creates a class derived from aninstantiation of ``iterator_adaptor`` and then selectivelyredefines some of the core member functions described in the``iterator_facade`` core requirements table. The ``Base`` type neednot meet the full requirements for an iterator; it need onlysupport the operations used by the core interface functions of``iterator_adaptor`` that have not been redefined in the user'sderived class.Several of the template parameters of ``iterator_adaptor`` defaultto ``use_default``. This allows theuser to make use of a default parameter even when she wants tospecify a parameter later in the parameter list. Also, thedefaults for the corresponding associated types are somewhatcomplicated, so metaprogramming is required to compute them, and``use_default`` can help to simplify the implementation. Finally,the identity of the ``use_default`` type is not left unspecifiedbecause specification helps to highlight that the ``Reference``template parameter may not always be identical to the iterator's``reference`` type, and will keep users from making mistakes based onthat assumption.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?