powerd++  0.4.4
Public Member Functions | Private Attributes | List of all members
utility::Sum< T > Class Template Reference

A simple value container only allowing += and copy assignment. More...

#include <utility.hpp>

Collaboration diagram for utility::Sum< T >:
[legend]

Public Member Functions

constexpr Sum (T const &value)
 Construct from an initial value. More...
 
constexpr Sum ()
 Default construct.
 
constexpr operator T const & () const
 Returns the current sum of values. More...
 
constexpr Sumoperator+= (T const &value)
 Add a value to the sum. More...
 

Private Attributes

value
 The sum of values accumulated.
 

Detailed Description

template<typename T>
class utility::Sum< T >

A simple value container only allowing += and copy assignment.

Template Parameters
TThe value type

Constructor & Destructor Documentation

◆ Sum()

template<typename T >
constexpr utility::Sum< T >::Sum ( T const &  value)
inlineexplicitconstexpr

Construct from an initial value.

Parameters
valueThe initial value

Member Function Documentation

◆ operator T const &()

template<typename T >
constexpr utility::Sum< T >::operator T const & ( ) const
inlineconstexpr

Returns the current sum of values.

Returns
The sum of values by const reference

◆ operator+=()

template<typename T >
constexpr Sum& utility::Sum< T >::operator+= ( T const &  value)
inlineconstexpr

Add a value to the sum.

Parameters
valueThe value to add to the current sum
Returns
A self reference

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