Skip to content

Instantly share code, notes, and snippets.

@OsePedro
OsePedro / rmc_Bitmask.cpp
Created November 27, 2017 11:45
A C++ enum-class-compatible implementation of bitmasks, inspired by this comment: http://disq.us/p/199xykc .
#include <type_traits>
#include <cinttypes>
#include <cstddef>
template<bool... Vs>
constexpr bool anyTrue() {
bool vs[]={Vs...};
for(size_t i=0; i<sizeof...(Vs); ++i) {if(vs[i]) {return true;}}
return false;
}