title: Given two objects s1 and s2 of a struct which only contains boolean type members, check if each member of s2 is true whenver this member of s1 is true
body: <p>I've got a struct <code>S</code> which contains only elements of a single boolean type <code>Bool</code>. These elements are not stored in an array. So, the struct is of the form <code>struct s { Bool a, b, c, ... };</code>.</p>
  
  <p>Now, I've got two objects <code>o1</code> and <code>o2</code> of type <code>S</code> and I need to have a function <code>test</code> wich does the following: </p>
  
  <pre><code>bool test(S o1, S o2)
  {
      if (o1.a &amp;&amp; !o2.a)
          return false;
      if (o1.b &amp;&amp; !o2.b)
          return false;
      if (o1.c &amp;&amp; !o2.c)
          return false;
  
      ...
  
      return true;
  }
  </code></pre>
  
  <p>Is there any better way to do that? The strucht <code>S</code> might change in the future (i.e. some fields may be added; others may be removed) while <code>test</code> should perform the same work.</p>
  
  <p>We could, for example, <code>reinterpret_cast</code> <code>&amp;o1</code> and <code>&amp;o2</code> to pointers of type <code>Bool*</code> and perform the check, but maybe there is a better option.</p>
  
  <p>(Note that <code>S</code> is given by a library that I'm using and hence I cannot change its definition.)</p>