C++ Checking a function's "flag argument"
<p>How do we create or show an error or a warning to the user the he/she
can not input flags that have the opposite value of another inputted
flag or to show he/she have made an invalid argument.</p>

<pre><code>struct Flags
{
    enum Values
    {
        None = 0,
        Yes = 1,
        No = 2,
        Good = 4,
        Bad = 8
    };
};

void Function( __in int p_Flag )
{
    if( p_Flag &amp; Flags::Yes )
        std::cout &lt;&lt; "Yes\n";
    else if( p_Flag &amp; Flags::No )
        std::cout &lt;&lt; "No\n";

    if( p_Flag &amp; Flags::Good )
        std::cout &lt;&lt; "Good\n";
    else if( p_Flag &amp; Flags::Bad )
        std::cout &lt;&lt; "Bad\n";
};

int main( void )
{
    Function( Flags::Yes | Flags::No );         // Error/warning (not OK)
    Function( Flags::Good | Flags::Bad );       // Error/warning (not OK)
    Function( Flags::Yes | Flags::Bad );        // OK!

    return( 0 );
};
</code></pre>

<p>Although the first opposite flag will be chosen over the other, we should still show a warning or the error to ensure which flag that the user really needed.</p>

<pre><code>Function( Flags::Yes | Flags::No );
</code></pre>
