#include <iostream>
#include <bitset>
int main()
{
constexpr std::size_t NBOOLS = 5 ;
// http://e...content-available-to-author-only...e.com/w/cpp/utility/bitset
std::bitset<NBOOLS> group ; // group of 5 bits (or 5 boolean values)
auto zero = group[0] ;
auto one = group[1] ;
auto two = group[2] ;
auto three = group[3] ;
auto four = group[4] ;
two = true ;
three = true ;
std::cout << std::boolalpha ;
for( std::size_t i = 0 ; i < NBOOLS ; ++i )
std::cout << "group[" << i << "] == " << group[i] << '\n' ;
std::cout << "group: " << group << '\n' ;
// is any of the boolean values true? (is any bit set?)
if( group.any() ) std::cout << "atleast one of the " << group.size() << " is true (set)\n" ;
// are all of them false? (is no bit set?)
if( group.none() ) std::cout << "none of the " << group.size() << " are true (set)\n" ;
// how many are true (set)?
std::cout << group.count() << " of the " << group.size() << " are true (set)\n" ;
zero = true ; // set zero to true
three = false ; // set three to false
four.flip() ; // toggle four
std::cout << "group: " << group << '\n' ;
std::cout << group.count() << " of the " << group.size() << " are true (set)\n" ;
// etc.
}