title: Is it possible to pass parameters into a function using a switch statement in c++?
body: <p>Is there any way to pass parameters into functions using switch statements in c++?  What I am trying to achieve is turning a series of if statements into one switch statement.</p>
  
  <p>As an example, I'd like to turn this:</p>
  
  <pre><code>if (function(a)) {
    //code
  }
  
  if (function(b)) {
    //code
  }
  
  if (function(c)) {
    //code
  }
  </code></pre>
  
  <p>into this:</p>
  
  <pre><code>switch (function(a/b/c)) {
  case a:
    //code
  case b:
    //code
  case c:
    //code
  }
  </code></pre>
  
  <p>The function returns true or false depending on whether or not a, b, or c is active.  It is important to note that a, b, and c would indeed be constants, but the function itself would determine whether or not they're currently active.  The problem I am working on is whether or not a key is currently pressed when the function is given the key code to check.  It looks something like this:</p>
  
  <pre><code>if (isKeyPressed(Key::A)) {
    //code
  }
  </code></pre>
  
  <p>Is this possible or does it break what a switch statement fundamentally is?</p>