12#ifndef ZYPP_CORE_BASE_DEFAULTINTEGRAL_H
13#define ZYPP_CORE_BASE_DEFAULTINTEGRAL_H
16#include <boost/static_assert.hpp>
17#include <boost/type_traits/is_integral.hpp>
40 template<
class Tp, Tp TInitial>
49 { BOOST_STATIC_ASSERT(boost::is_integral<Tp>::value); }
56 operator Tp &() {
return get(); }
57 operator Tp ()
const {
return get(); }
61 constexpr Tp
initial()
const {
return TInitial; }
94 template<
typename TIntegral>
97 template<
class Tp, Tp TInitial>
99 {
return asString( obj.
get() ); }
Integral type with defined initial value when default constructed.
DefaultIntegral< bool, false > FalseBool
false initialized bool
DefaultIntegral & operator++()
DefaultIntegral & operator=(Tp rhs)
DefaultIntegral & operator+=(Tp rhs)
DefaultIntegral & operator--()
DefaultIntegral operator--(int)
constexpr Tp initial() const
The initial value.
DefaultIntegral< bool, true > TrueBool
true initialized bool
DefaultIntegral & operator-=(Tp rhs)
DefaultIntegral(Tp val_r=TInitial)
DefaultIntegral & operator/=(Tp rhs)
DefaultIntegral & operator*=(Tp rhs)
DefaultIntegral & reset()
Reset to the defined initial value.
Tp & get()
Conversion to Tp.
DefaultIntegral operator++(int)
Easy-to use interface to the ZYPP dependency resolver.