TrivialOutputIteratorCount Class Reference

A trivial output iterator that counts assignments. More...

#include <TrivialOutputIterator.h>

Inheritance diagram for TrivialOutputIteratorCount:
TrivialOutputIterator

List of all members.

Public Types

typedef Base::iterator_category iterator_category
 The iterator category.
typedef Base::value_type value_type
 The type "pointed to" by the iterator.
typedef Base::difference_type difference_type
 Distance between iterators is represented as this type.
typedef Base::pointer pointer
 This type represents a pointer-to-value_type.
typedef Base::reference reference
 This type represents a reference-to-value_type.

Public Member Functions

Constructors etc.

 TrivialOutputIteratorCount (int &count)
 Construct from a count variable.
 TrivialOutputIteratorCount (const TrivialOutputIteratorCount &other)
 Copy constructor.
Functionality

template<typename Value >
TrivialOutputIteratorCountoperator= (const Value &)
 Assignment of the "value type".
int get () const
 Return the number of assignments.
void reset ()
 Reset the assignment count to zero.
TrivialOutputIteratorCountoperator* ()
 Dereference.
TrivialOutputIteratorCountoperator++ ()
 Pre-increment.
TrivialOutputIteratorCountoperator++ (int)
 Post-increment.

Detailed Description

A trivial output iterator that counts assignments.

This is useful when you need a null container. When a function writes to an output iterator, but you do not need that result, you can use this trivial output iterator.


Member Function Documentation

TrivialOutputIteratorCount& TrivialOutputIteratorCount::operator++ ( int   )  [inline]

Post-increment.

Usually one returns the object and not a reference to it. Here I need to return a reference for the counting to work.

Reimplemented from TrivialOutputIterator.


The documentation for this class was generated from the following file:
Generated on Thu Jun 30 02:14:52 2016 for Algorithms and Data Structures Package by  doxygen 1.6.3