GNU CommonC++
ost::Counter< T > Class Template Reference

The counter template is used for generic objects which act as automatic counters. More...

#include <counter.h>

Public Member Functions

 Counter ()
 Construct and initialize a counter to zero.
 Counter (const Counter &counter)
 Construct a counter with an initial value set for another counter.
 Counter (T initial)
 Construct a counter with an initial value of the specified data type.
T & operator= (T c)
 operator T ()

Protected Attributes

count

Detailed Description

template<typename T>
class ost::Counter< T >

The counter template is used for generic objects which act as automatic counters.

Each time the object is accessed, the underlying counted data type is incremented.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Automatic counter template class.

Constructor & Destructor Documentation

◆ Counter() [1/3]

template<typename T>
ost::Counter< T >::Counter ( )
inline

Construct and initialize a counter to zero.

References count.

Referenced by Counter().

◆ Counter() [2/3]

template<typename T>
ost::Counter< T >::Counter ( const Counter< T > & counter)
inline

Construct a counter with an initial value set for another counter.

Parameters
counterto copy from.

References count, and Counter().

◆ Counter() [3/3]

template<typename T>
ost::Counter< T >::Counter ( T initial)
inline

Construct a counter with an initial value of the specified data type.

Parameters
initialvalue to set.

References count.

Member Function Documentation

◆ operator T()

template<typename T>
ost::Counter< T >::operator T ( )
inline

References count.

◆ operator=()

template<typename T>
T & ost::Counter< T >::operator= ( T c)
inline

Member Data Documentation

◆ count

template<typename T>
T ost::Counter< T >::count
protected

Referenced by Counter(), Counter(), Counter(), and operator T().


The documentation for this class was generated from the following file: