Browse Source

Removed superfluous operators from Set class.

Moreover returning base type from & operator is bad, really bad: if it
results in 0, how it will map to original enum?
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
fd0b01510c
  1. 16
      src/Set.h

16
src/Set.h

@ -54,33 +54,17 @@ template<class T, class U> class Set {
/** @brief Create set from one value */
inline constexpr Set(T value): value(static_cast<UnderlyingType>(value)) {}
/** @brief Add value to the set */
inline constexpr Set<T, U> operator|(T other) const {
return Set<T, U>(value | static_cast<UnderlyingType>(other));
}
/** @brief Union of two sets */
inline constexpr Set<T, U> operator|(Set<T, U> other) const {
return Set<T, U>(value | other.value);
}
/** @brief Add value to the set and assign */
inline Set<T, U>& operator|=(T other) {
value |= static_cast<UnderlyingType>(other);
return *this;
}
/** @brief Union two sets and assign */
inline Set<T, U>& operator|=(Set<T, U> other) {
value |= other.value;
return *this;
}
/** @brief Check if given value is in the set */
inline constexpr T operator&(T other) const {
return static_cast<T>(value & static_cast<UnderlyingType>(other));
}
/** @brief Intersection of two sets */
inline constexpr Set<T, U> operator&(Set<T, U> other) const {
return Set<T, U>(value & other.value);

Loading…
Cancel
Save