libzypp  13.10.6
zypp::DefaultIntegral< _Tp, _Initial > Class Template Reference

Integral type with defined initial value when default constructed. More...

#include <DefaultIntegral.h>

Public Types

typedef _Tp value_type
 

Public Member Functions

 DefaultIntegral (_Tp val_r=_Initial)
 
DefaultIntegralreset ()
 Reset to the defined initial value. More...
 
_Tp & get ()
 Conversion to _Tp. More...
 
_Tp get () const
 
 operator _Tp & ()
 
 operator _Tp () const
 
Arithmetic operations.

+ - * / are provided via conversion to _Tp.

DefaultIntegraloperator= (_Tp rhs)
 
DefaultIntegraloperator+= (_Tp rhs)
 
DefaultIntegraloperator-= (_Tp rhs)
 
DefaultIntegraloperator*= (_Tp rhs)
 
DefaultIntegraloperator/= (_Tp rhs)
 
DefaultIntegraloperator++ ()
 
DefaultIntegraloperator-- ()
 
DefaultIntegral operator++ (int)
 
DefaultIntegral operator-- (int)
 

Private Attributes

_Tp _val
 

Detailed Description

template<class _Tp, _Tp _Initial>
class zypp::DefaultIntegral< _Tp, _Initial >

Integral type with defined initial value when default constructed.

* typedef DefaultIntegral<unsigned,0> Counter;
* std::map<KeyType,Counter> stats;
* for ( all keys )
* ++(stats[key]);
*
Todo:

maybe specialize for bool, add logical and bit operators

let _Initial default to 0 then remove base/Counter.h

Definition at line 41 of file DefaultIntegral.h.

Member Typedef Documentation

template<class _Tp, _Tp _Initial>
typedef _Tp zypp::DefaultIntegral< _Tp, _Initial >::value_type

Definition at line 44 of file DefaultIntegral.h.

Constructor & Destructor Documentation

template<class _Tp, _Tp _Initial>
zypp::DefaultIntegral< _Tp, _Initial >::DefaultIntegral ( _Tp  val_r = _Initial)
inline

Definition at line 47 of file DefaultIntegral.h.

Member Function Documentation

template<class _Tp, _Tp _Initial>
_Tp& zypp::DefaultIntegral< _Tp, _Initial >::get ( )
inline

Conversion to _Tp.

Definition at line 53 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
_Tp zypp::DefaultIntegral< _Tp, _Initial >::get ( ) const
inline

Definition at line 54 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
zypp::DefaultIntegral< _Tp, _Initial >::operator _Tp & ( )
inline

Definition at line 56 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
zypp::DefaultIntegral< _Tp, _Initial >::operator _Tp ( ) const
inline

Definition at line 57 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral& zypp::DefaultIntegral< _Tp, _Initial >::reset ( )
inline

Reset to the defined initial value.

Definition at line 61 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral& zypp::DefaultIntegral< _Tp, _Initial >::operator= ( _Tp  rhs)
inline

Definition at line 67 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral& zypp::DefaultIntegral< _Tp, _Initial >::operator+= ( _Tp  rhs)
inline

Definition at line 68 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral& zypp::DefaultIntegral< _Tp, _Initial >::operator-= ( _Tp  rhs)
inline

Definition at line 69 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral& zypp::DefaultIntegral< _Tp, _Initial >::operator*= ( _Tp  rhs)
inline

Definition at line 70 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral& zypp::DefaultIntegral< _Tp, _Initial >::operator/= ( _Tp  rhs)
inline

Definition at line 71 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral& zypp::DefaultIntegral< _Tp, _Initial >::operator++ ( )
inline

Definition at line 73 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral& zypp::DefaultIntegral< _Tp, _Initial >::operator-- ( )
inline

Definition at line 74 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral zypp::DefaultIntegral< _Tp, _Initial >::operator++ ( int  )
inline

Definition at line 76 of file DefaultIntegral.h.

template<class _Tp, _Tp _Initial>
DefaultIntegral zypp::DefaultIntegral< _Tp, _Initial >::operator-- ( int  )
inline

Definition at line 77 of file DefaultIntegral.h.

Member Data Documentation

template<class _Tp, _Tp _Initial>
_Tp zypp::DefaultIntegral< _Tp, _Initial >::_val
private

Definition at line 81 of file DefaultIntegral.h.


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