#include <comstl/collections/enumerator_sequence.hpp>

| I | Interface | |
| V | Value type | |
| VP | Value policy type | |
| R | Reference type. The type returned by the iterator's dereference operator. Defaults to V const&. To make it mutable, set to V& | |
| CP | Cloning policy type. Defaults to cloneable_cloning_policy<I> | |
| Q | Quanta. The number of elements retrieved from the enumerator with each invocation of Next(). Defaults to 10 |
For example, the following parameterisation defines a sequence operating over an IEnumGUID enumerator instance.
typedef enumerator_sequence<IEnumGUID , GUID , GUID_policy , GUID const& , forward_cloning_policy<IEnumGUID> , 5 > enum_sequence_t;
The value type is GUID and it is returned as a reference, as the GUID const& in fact.
The COMSTL type GUID_policy controls how the GUID instances are initialised, copied and destroyed.
The COMSTL type forward_cloning_policy allows the sequence to provide Forward Iterator semantics.
And the 5 indicates that the sequence should grab 5 values at a time, to save round trips to the enumerator.
This would be used as follows:
void dump_GUID(GUID const&); LPENUMGUID penGUIDs = . . .; // Create an instance from wherever enum_sequence_t guids(penGUIDs, false); // Consume the reference std::for_each(guids.begin(), guids.end(), dump_GUID);
Iteration | |
| typedef iterator | const_iterator |
| The non-mutating (const) iterator type. | |
| iterator | begin () const |
| Begins the iteration. | |
| iterator | end () const |
| Ends the iteration. | |
Public Types | |
Member Types | |
| enum | { retrievalQuanta = Q } |
| Retrieval quanta. More... | |
| typedef I | interface_type |
| Interface type. | |
| typedef V | value_type |
| Value type. | |
| typedef value_policy_adaptor< VP > | value_policy_type |
| Value policy type. | |
| typedef R | reference |
| Reference type. | |
| typedef value_type * | pointer |
| The mutating (non-const) pointer type. | |
| typedef value_type const * | const_pointer |
| The non-mutating (const) pointer type. | |
| typedef CP | cloning_policy_type |
| Cloning policy type. | |
| typedef cloning_policy_type::iterator_tag_type | iterator_tag_type |
| Iterator tag type. | |
| typedef enumerator_sequence< I, V, VP, R, CP, Q > | class_type |
| Type of the current parameterisation. | |
| typedef class_type | sequence_type |
| Type of the current parameterisation. | |
| typedef size_t | size_type |
| The size type. | |
| typedef cs_ptrdiff_t | difference_type |
| The difference type. | |
| typedef bool | bool_type |
| The Boolean type. | |
Public Member Functions | |
| enumerator_sequence (interface_type *i, bool_type bAddRef, size_type quanta=0, bool_type bReset=true) | |
| Conversion constructor. | |
| ~enumerator_sequence () throw () | |
| Releases the adapted interface pointer. | |
Static Public Member Functions | |
Attributes | |
| static size_type | quanta () |
Classes | |
| class | iterator |
| Iterator for the enumerator_sequence class. More... | |
| typedef I interface_type |
Interface type.
| typedef V value_type |
Value type.
| typedef value_policy_adaptor<VP> value_policy_type |
Value policy type.
| typedef R reference |
Reference type.
| typedef value_type* pointer |
The mutating (non-const) pointer type.
| typedef value_type const* const_pointer |
The non-mutating (const) pointer type.
| typedef CP cloning_policy_type |
Cloning policy type.
| typedef cloning_policy_type::iterator_tag_type iterator_tag_type |
Iterator tag type.
| typedef enumerator_sequence<I, V, VP, R, CP, Q> class_type |
Type of the current parameterisation.
| typedef class_type sequence_type |
Type of the current parameterisation.
| typedef size_t size_type |
The size type.
| typedef cs_ptrdiff_t difference_type |
The difference type.
| typedef bool bool_type |
The Boolean type.
| typedef iterator const_iterator |
The non-mutating (const) iterator type.
| anonymous enum |
Retrieval quanta.
| enumerator_sequence | ( | interface_type * | i, | |
| bool_type | bAddRef, | |||
| size_type | quanta = 0, |
|||
| bool_type | bReset = true | |||
| ) | [inline] |
Conversion constructor.
| i | The enumeration interface pointer to adapt | |
| bAddRef | Causes a reference to be added if true, otherwise the sequence is deemed to sink, or consume, the interface pointer | |
| quanta | The actual quanta required for this instance. Must be <= Q. Defaults to 0, which causes it to be Q | |
| bReset | Determines whether the Reset() method is invoked on the enumerator instance upon construction. Defaults to true |
References COMSTL_ASSERT, and COMSTL_MESSAGE_ASSERT.
| ~enumerator_sequence | ( | ) | throw () [inline] |
| iterator begin | ( | ) | const [inline] |
Begins the iteration.
References COMSTL_ASSERT.
| iterator end | ( | ) | const [inline] |
Ends the iteration.
References COMSTL_ASSERT.
1.5.6