yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis 2.0.0
YODA::ArithmeticWrapper< T > Struct Template Reference

Arithmetic wrapper to emulate inheritance from arithmetic types. More...

#include <Bin.h>

Public Member Functions

Constructors
 ArithmeticWrapper ()
 
 ArithmeticWrapper (T num)
 
Arithmetic operators
ArithmeticWrapper< T > & operator+= (T &&rhs)
 
ArithmeticWrapper< T > & operator-= (T &&rhs)
 
ArithmeticWrapper< T > & operator/= (T &&rhs)
 
ArithmeticWrapper< T > & operator*= (T &&rhs)
 
template<typename RetT = ArithmeticWrapper<T>>
auto operator%= (T &&rhs) -> std::enable_if_t< std::is_integral< T >::value, RetT & >
 
 operator T ()
 Casts ArithmeticWrapper to the contained type.
 
 operator const T & () const
 Casts ArithmeticWrapper to the contained type (const version).
 

Detailed Description

template<typename T>
struct YODA::ArithmeticWrapper< T >

Arithmetic wrapper to emulate inheritance from arithmetic types.

Definition at line 17 of file Bin.h.

Constructor & Destructor Documentation

◆ ArithmeticWrapper() [1/2]

template<typename T >
YODA::ArithmeticWrapper< T >::ArithmeticWrapper ( )
inline

Definition at line 20 of file Bin.h.

20: _storedNumber(0) {}

◆ ArithmeticWrapper() [2/2]

template<typename T >
YODA::ArithmeticWrapper< T >::ArithmeticWrapper ( num)
inline

Definition at line 22 of file Bin.h.

22: _storedNumber(num) {}

Member Function Documentation

◆ operator const T &()

template<typename T >
YODA::ArithmeticWrapper< T >::operator const T & ( ) const
inline

Casts ArithmeticWrapper to the contained type (const version).

Note
Used in raw() function of BinBase.

Definition at line 63 of file Bin.h.

63{ return _storedNumber; }

◆ operator T()

template<typename T >
YODA::ArithmeticWrapper< T >::operator T ( )
inline

Casts ArithmeticWrapper to the contained type.

Note
Used in arithmetic operators, so the default language arithmetic operators are used.

Definition at line 58 of file Bin.h.

58{ return _storedNumber; }

◆ operator%=()

template<typename T >
template<typename RetT = ArithmeticWrapper<T>>
auto YODA::ArithmeticWrapper< T >::operator%= ( T &&  rhs) -> std::enable_if_t<std::is_integral<T>::value, RetT&>
inline
Note
Template to make enable_if work.

Definition at line 47 of file Bin.h.

48 {
49 _storedNumber %= std::forward<T>(rhs);
50 return *this;
51 }

◆ operator*=()

template<typename T >
ArithmeticWrapper< T > & YODA::ArithmeticWrapper< T >::operator*= ( T &&  rhs)
inline

Definition at line 40 of file Bin.h.

40 {
41 _storedNumber *= std::forward<T>(rhs);
42 return *this;
43 }

◆ operator+=()

template<typename T >
ArithmeticWrapper< T > & YODA::ArithmeticWrapper< T >::operator+= ( T &&  rhs)
inline

Definition at line 28 of file Bin.h.

28 {
29 _storedNumber += std::forward<T>(rhs);
30 return *this;
31 }

◆ operator-=()

template<typename T >
ArithmeticWrapper< T > & YODA::ArithmeticWrapper< T >::operator-= ( T &&  rhs)
inline

Definition at line 32 of file Bin.h.

32 {
33 _storedNumber -= std::forward<T>(rhs);
34 return *this;
35 }

◆ operator/=()

template<typename T >
ArithmeticWrapper< T > & YODA::ArithmeticWrapper< T >::operator/= ( T &&  rhs)
inline

Definition at line 36 of file Bin.h.

36 {
37 _storedNumber /= std::forward<T>(rhs);
38 return *this;
39 }

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