Help !

template <typename T> class enum_set {
public:
        typedef int value_type;
 
        enum_set() : val_(0) {}
        enum_set(T t) : val_(t) {}
 
        bool operator==(enum_set<T> const & s) const {
                return val_ == s.val_;
        }
 
        bool operator!=(enum_set<T> const & s) const {
                return !(s == *this);
        }
 
        enum_set operator|(enum_set<T> const & s) const {
                return enum_set<T>(val_ | s.val_);
        }
 
        enum_set operator&(enum_set<T> const & s) const {
                return enum_set<T>(val_ & s.val_);
        }
 
        enum_set & operator=(enum_set<T> const & s) {
                val_ = s.val_; return *this;
        }
 
        void operator|=(enum_set<T> const & s) {
                (*this) = (*this) | s;
        }
 
        void operator&=(enum_set<T> const & s) {
                (*this) = (*this) & s;
        }
 
private:
        // used by operators above
        enum_set(value_type v) : val_(v) { }
 
        value_type val_;
};

HTF do I get :

        if (blah & key_modifier::ctrl)

to work ??

        operator bool() conversion just gives ambiguous overloads

Please diss the above where necessary as well please.

thanks
john

-- 
"Time is a great teacher, but unfortunately it kills all its pupils."
        - Hector Louis Berlioz 

Reply via email to