Compile-time assert when not all enum values are handled in a switch statement in C++
<p>I'd like to get a compiler warning or error when not all possible enum values are handled in a switch statement. Of course I can add a default case with an assert and (eventually) get an error at runtime. But I'd like to get an error at compile-time.</p>

<p>I'm not sure if this is possible at all with C++, but maybe someone knows a trick...</p>

<p>Edit:
Using <code>-Wswitch</code> seems to be the solution for GCC. Is there something similar for VS2010? (I'm not using GCC).</p>

<p>Edit2:
Ok, I found the solution for VC++ (VS2010):</p>

<p>Enabling warning <code>C4062</code> produces a warning when a value is missing und no default case is provided.</p>

<p>Enabling warning <code>C4061</code> produces a warning when a value is missing, even if a default case is provided.</p>
