rendered paste bodytemplate<typename Value_Type, Value_Type value_ = Value_Type(0) >class def_value{ template<class V, V val> friend class def_value; Value_Type t;public: explicit def_value() : t(value_) {} explicit def_value(Value_Type const& tt) : t(tt) {} //really need? /////// binary operators ///////// template<class V>inline Value_Type operator | (V const& v) const { return t | v; } template<class V>inline Value_Type operator & (V const& v) const { return t & v; } template<class V>inline Value_Type operator ^ (V const& v) const { return t ^ v; } //there is ^= operator? template<class V>inline Value_Type& operator |= (V const& v) { return t |= v; } template<class V>inline Value_Type& operator &= (V const& v) { return t &= v; } inline Value_Type operator ~ () const { return ~t; } template<class V,V val>inline Value_Type operator | (def_value<V,val> const& v) const { return t | v.t; } template<class V,V val>inline Value_Type operator & (def_value<V,val> const& v) const { return t & v.t; } template<class V,V val>inline Value_Type operator ^ (def_value<V,val> const& v) const { return t ^ v.t; } //there is ^= operator? template<class V,V val>inline Value_Type& operator |= (def_value<V,val> const& v) { return t |= v.t; } template<class V,V val>inline Value_Type& operator &= (def_value<V,val> const& v) { return t &= v.t; } template<class V>inline Value_Type operator << (V const& v) const { return t << v; } template<class V>inline Value_Type operator >> (V const& v) const { return t >> v; } template<class V>inline Value_Type& operator <<= (V const& v) { return t <<= v; } template<class V>inline Value_Type& operator >>= (V const& v) { return t >>= v; } template<class V,V val>inline Value_Type operator << (def_value<V,val> const& v) const { return t << v.t; } template<class V,V val>inline Value_Type operator >> (def_value<V,val> const& v) const { return t >> v.t; } template<class V,V val>inline Value_Type& operator <<= (def_value<V,val> const& v) { return t <<= v.t; } template<class V,V val>inline Value_Type& operator >>= (def_value<V,val> const& v) { return t >>= v.t; } ////////////////////////////////////////// template<class V>inline Value_Type operator + (V const& v) const { return t + v; } template<class V>inline Value_Type operator - (V const& v) const { return t - v; } template<class V>inline Value_Type operator * (V const& v) const { return t * v; } template<class V>inline Value_Type operator / (V const& v) const { return t / v; } template<class V>inline Value_Type& operator += (V const& v) { return t += v; } template<class V>inline Value_Type& operator -= (V const& v) { return t -= v; } template<class V>inline Value_Type& operator *= (V const& v) { return t *= v; } template<class V>inline Value_Type& operator /= (V const& v) { return t /= v; } // templ part template<class V,V val>inline Value_Type operator + (def_value<V,val> const& v) const { return t + v.t; } template<class V,V val>inline Value_Type operator - (def_value<V,val> const& v) const { return t - v.t; } template<class V,V val>inline Value_Type operator * (def_value<V,val> const& v) const { return t * v.t; } template<class V,V val>inline Value_Type operator / (def_value<V,val> const& v) const { return t / v; } template<class V,V val>inline Value_Type& operator += (def_value<V,val> const& v) { return t += v.t; } template<class V,V val>inline Value_Type& operator -= (def_value<V,val> const& v) { return t -= v.t; } template<class V,V val>inline Value_Type& operator *= (def_value<V,val> const& v) { return t *= v.t; } template<class V,V val>inline Value_Type& operator /= (def_value<V,val> const& v) { return t /= v.t; } //////////////////////////////////////////// //logic template<class V>inline bool operator == (V const& v) const { return t == v; } template<class V>inline bool operator > (V const& v) const { return t > v; } template<class V>inline bool operator < (V const& v) const { return t < v; } template<class V>inline bool operator >= (V const& v) const { return t >= v; } template<class V>inline bool operator <= (V const& v) const { return t <= v; } template<class V,V val>inline bool operator == (def_value<V,val> const& v) const { return t == v.t; } template<class V,V val>inline bool operator > (def_value<V,val> const& v) const { return t > v.t; } template<class V,V val>inline bool operator < (def_value<V,val> const& v) const { return t < v.t; } template<class V,V val>inline bool operator >= (def_value<V,val> const& v) const { return t >= v.t; } template<class V,V val>inline bool operator <= (def_value<V,val> const& v) const { return t <= v.t; } inline bool operator ! () const { return !t; } template<class V>inline Value_Type& operator = (V const& v) { return t = v; } template<class V,V val>inline Value_Type& operator = (def_value<V,val> const& v) { return t = v.t; }};