Skip to content

Instantly share code, notes, and snippets.

@asarium
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asarium/efd998aebff3e90cc535 to your computer and use it in GitHub Desktop.
Save asarium/efd998aebff3e90cc535 to your computer and use it in GitHub Desktop.
/*Flagset*/
template <class T,
typename size_type = typename std::underlying_type<T>::type,
size_type size = static_cast<size_type>(T::NUM_VALUES)>
class flagset {
SCP_bitset<size> values;
public:
bool& operator[](T idx) { return values[(static_cast<size_type>(idx)]; };
const bool& operator[](T idx) { return values[static_cast<size_type>(idx)]; } const;
};
#define FLAG_LIST(Type) enum class Type : size_t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment