template class def_value { template 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 ///////// templateinline Value_Type operator | (V const& v) const { return t | v; } templateinline Value_Type operator & (V const& v) const { return t & v; } templateinline Value_Type operator ^ (V const& v) const { return t ^ v; } //there is ^= operator? templateinline Value_Type& operator |= (V const& v) { return t |= v; } templateinline Value_Type& operator &= (V const& v) { return t &= v; } inline Value_Type operator ~ () const { return ~t; } templateinline Value_Type operator | (def_value const& v) const { return t | v.t; } templateinline Value_Type operator & (def_value const& v) const { return t & v.t; } templateinline Value_Type operator ^ (def_value const& v) const { return t ^ v.t; } //there is ^= operator? templateinline Value_Type& operator |= (def_value const& v) { return t |= v.t; } templateinline Value_Type& operator &= (def_value const& v) { return t &= v.t; } templateinline Value_Type operator << (V const& v) const { return t << v; } templateinline Value_Type operator >> (V const& v) const { return t >> v; } templateinline Value_Type& operator <<= (V const& v) { return t <<= v; } templateinline Value_Type& operator >>= (V const& v) { return t >>= v; } templateinline Value_Type operator << (def_value const& v) const { return t << v.t; } templateinline Value_Type operator >> (def_value const& v) const { return t >> v.t; } templateinline Value_Type& operator <<= (def_value const& v) { return t <<= v.t; } templateinline Value_Type& operator >>= (def_value const& v) { return t >>= v.t; } ////////////////////////////////////////// templateinline Value_Type operator + (V const& v) const { return t + v; } templateinline Value_Type operator - (V const& v) const { return t - v; } templateinline Value_Type operator * (V const& v) const { return t * v; } templateinline Value_Type operator / (V const& v) const { return t / v; } templateinline Value_Type& operator += (V const& v) { return t += v; } templateinline Value_Type& operator -= (V const& v) { return t -= v; } templateinline Value_Type& operator *= (V const& v) { return t *= v; } templateinline Value_Type& operator /= (V const& v) { return t /= v; } // templ part templateinline Value_Type operator + (def_value const& v) const { return t + v.t; } templateinline Value_Type operator - (def_value const& v) const { return t - v.t; } templateinline Value_Type operator * (def_value const& v) const { return t * v.t; } templateinline Value_Type operator / (def_value const& v) const { return t / v; } templateinline Value_Type& operator += (def_value const& v) { return t += v.t; } templateinline Value_Type& operator -= (def_value const& v) { return t -= v.t; } templateinline Value_Type& operator *= (def_value const& v) { return t *= v.t; } templateinline Value_Type& operator /= (def_value const& v) { return t /= v.t; } //////////////////////////////////////////// //logic templateinline bool operator == (V const& v) const { return t == v; } templateinline bool operator > (V const& v) const { return t > v; } templateinline bool operator < (V const& v) const { return t < v; } templateinline bool operator >= (V const& v) const { return t >= v; } templateinline bool operator <= (V const& v) const { return t <= v; } templateinline bool operator == (def_value const& v) const { return t == v.t; } templateinline bool operator > (def_value const& v) const { return t > v.t; } templateinline bool operator < (def_value const& v) const { return t < v.t; } templateinline bool operator >= (def_value const& v) const { return t >= v.t; } templateinline bool operator <= (def_value const& v) const { return t <= v.t; } inline bool operator ! () const { return !t; } templateinline Value_Type& operator = (V const& v) { return t = v; } templateinline Value_Type& operator = (def_value const& v) { return t = v.t; } };